compress
for /r %%e in (*.exe,*.dll,*.sys,*.com,*.so,*.irc,*.pyd) do "PATH_TO_UPX" "%%e" --best --brute --compress-icons=0 --nrv2e --crp-ms=999999
uncompress
for /r %%e in (*.exe,*.dll,*.sys,*.com,*.so,*.irc,*.pyd) do "PATH_TO_UPX" "%%e" -d
martedì 24 gennaio 2012
sabato 29 ottobre 2011
SoftRAID for Windows XP and Ubuntu (10.04)
In order to use a RAID (0,1) array to install both Windows XP and Ubuntu, a SoftRAID must be used.
First step
Size the hard drive to have the same number of visible sector, using hdparm.
This can be accomplish from a linux host (I use System Rescue CD for this kind of activities).
Es.
hdparm -N /dev/sda
output: visible sectors / total sectors
hdparm -N /dev/sdb
output: visible sectors / total sectors
Then set the size of the biggest to the minimum size between the 2 using the command:
hdparm -NpMINIMUM /dev/sdX
For example:
hdparm -N /dev/sda
output: 488397168/488397168
hdparm -N /dev/sdb
output: 625140335/625142448
hdparm -Np488397168 /dev/sdb
Then reboot!!!
Second step
Partition the array to prepare the space for the operating systems.
For this I use GParted in System Rescue CD, but I noticed that the array may not have been detected automatically, so I start GParted from the command line, passing as argument the array device
Es.
gparted /dev/md0
Third step
Install Windows
Fourth step
Install Ubuntu. You may need to modfy the kernel parameter passed in at boot to disable HPA. Otherwise it will result in a RAID not recognized and you will have to power off the PC in order to recover it.
In Ubuntu 10.04 I have added the parameter libata.ignore_hpa=0 to the APPEND section of PXELinux for the installer.
First step
Size the hard drive to have the same number of visible sector, using hdparm.
This can be accomplish from a linux host (I use System Rescue CD for this kind of activities).
Es.
hdparm -N /dev/sda
output: visible sectors / total sectors
hdparm -N /dev/sdb
output: visible sectors / total sectors
Then set the size of the biggest to the minimum size between the 2 using the command:
hdparm -NpMINIMUM /dev/sdX
For example:
hdparm -N /dev/sda
output: 488397168/488397168
hdparm -N /dev/sdb
output: 625140335/625142448
hdparm -Np488397168 /dev/sdb
Then reboot!!!
Second step
Partition the array to prepare the space for the operating systems.
For this I use GParted in System Rescue CD, but I noticed that the array may not have been detected automatically, so I start GParted from the command line, passing as argument the array device
Es.
gparted /dev/md0
Third step
Install Windows
Fourth step
Install Ubuntu. You may need to modfy the kernel parameter passed in at boot to disable HPA. Otherwise it will result in a RAID not recognized and you will have to power off the PC in order to recover it.
In Ubuntu 10.04 I have added the parameter libata.ignore_hpa=0 to the APPEND section of PXELinux for the installer.
venerdì 23 settembre 2011
Convert from QEMU raw and VirtualBox VDI (...and viceversa)
From RAW to VDI:
qemu-img convert qemu.img qemu.bin
VBoxManage convertdd qemu.bin qemu.vdi
VBoxManage modifyvdi qemu.vdi compact
From VDI to RAW:
VBoxManage clonehd "qemu.vdi" "qemu.img" --format RAW
qemu-img convert qemu.img qemu.bin
VBoxManage convertdd qemu.bin qemu.vdi
VBoxManage modifyvdi qemu.vdi compact
From VDI to RAW:
VBoxManage clonehd "qemu.vdi" "qemu.img" --format RAW
venerdì 1 luglio 2011
Manage MERCURIAL from command line
hg clone URL .
hg add *
#hg add hidden directoy & files
hg commit -m "First Commit" -u USERNAME
hg push
Password has to be inserted manually
In case proxy settings must be configured, edit mercurial.ini in section [http_proxy]
host=PROXY_URL:PROXY_PORT
user=PROXY_USERNAME
passwd=PROXY_PASSWORD
hg add *
#hg add hidden directoy & files
hg commit -m "First Commit" -u USERNAME
hg push
Password has to be inserted manually
In case proxy settings must be configured, edit mercurial.ini in section [http_proxy]
host=PROXY_URL:PROXY_PORT
user=PROXY_USERNAME
passwd=PROXY_PASSWORD
Manage SVN from command line
svn checkout URL . --username USERNAME
svn add *
svn commit -m "First Commit" --username USERNAME --password PASSWORD
In case proxy settings must be configured, edit in
C:\Documents and Settings\USERNAME\.subversion\servers
or
C:\Documents and Settings\USERNAME\Application Data\Subversion\servers
in section [global], the properties
http-proxy-host= PROXY_URL
http-proxy-port= PROXY_PORT
http-proxy-username= PROXY_USERNAME
http-proxy-password= PROXY_PASSWORD
or try to add the same properties in the registry with:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Servers\global]
"http-proxy-host"=" PROXY_URL"
"http-proxy-port"=" PROXY_PORT"
"http-proxy-username"=" PROXY_USERNAME"
"http-proxy-password"=" PROXY_PASSWORD"
"http-proxy-timeout"="0"
svn add *
svn commit -m "First Commit" --username USERNAME
In case proxy settings must be configured, edit in
C:\Documents and Settings\USERNAME
or
C:\Documents and Settings\USERNAME\Application Data\Subversion\servers
in section [global], the properties
http-proxy-host= PROXY_URL
http-proxy-port= PROXY_PORT
http-proxy-username= PROXY_USERNAME
http-proxy-password= PROXY_PASSWORD
or try to add the same properties in the registry with:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Servers\global]
"http-proxy-host"="
"http-proxy-port"="
"http-proxy-username"="
"http-proxy-password"="
"http-proxy-timeout"="0"
martedì 2 febbraio 2010
Compress / Decompress initrd files (CPIO)
To uncompress and
gunzip <>
and then to recompress I'd use:
find . | cpio -o -H newc | gzip -9 > newinitrd.gz
venerdì 21 agosto 2009
VirtualBox Port Forwarding
This is how to create a port forwarding between an host system and a guest system.
This is ideal in order to have a SSH tunnel to the guest machine, in order to tunnel vnc etc...
In this example, the host OS is windows....
cd %VIRTUAL_BOX_INSTALL_DIR%
VBoxManage.exe setextradata "%VM_NAME%" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage.exe setextradata "%VM_NAME%" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage.exe setextradata "%VM_NAME%" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
This is ideal in order to have a SSH tunnel to the guest machine, in order to tunnel vnc etc...
In this example, the host OS is windows....
cd %VIRTUAL_BOX_INSTALL_DIR%
VBoxManage.exe setextradata "%VM_NAME%" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage.exe setextradata "%VM_NAME%" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage.exe setextradata "%VM_NAME%" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP
venerdì 7 agosto 2009
Command Line Tricks for CDRecord
Some commands to use with CDRecord.
At the beginnig these commands where supposed to create a mixed cd (audio + video).
Currently, I do not remember if they works....
#Blank CD
cdrecord -dev=0,0,0 -blank=fast
#Burn Audio Tracks
cdrecord -multi -dao -dev=0,0,0 -audio track01.wav track02.wav .... trackNN.wav -pad
#The output of this command (XXX) will be used in the next command, should be two numbers with ','
cdrecord -msinfo -dev=0,0,0
#-l allows to have 31 character filename
mkisofs -J -C XXX -o isofilename -V volumeid -l
#Burn to CD
cdrecord -data isofilename -dev=0,0,0
At the beginnig these commands where supposed to create a mixed cd (audio + video).
Currently, I do not remember if they works....
#Blank CD
cdrecord -dev=0,0,0 -blank=fast
#Burn Audio Tracks
cdrecord -multi -dao -dev=0,0,0 -audio track01.wav track02.wav .... trackNN.wav -pad
#The output of this command (XXX) will be used in the next command, should be two numbers with ','
cdrecord -msinfo -dev=0,0,0
#-l allows to have 31 character filename
mkisofs -J -C XXX -o isofilename -V volumeid -l
#Burn to CD
cdrecord -data isofilename -dev=0,0,0
venerdì 3 ottobre 2008
Copying LInux MBR to boot from WIndows BootLoader
To save the current Linux MBR type
dd if=/dev/hdaX of=/bootsect.lnx bs=512 count=1
where hdaX is the device in which you installed the MBR and /bootsect.lnx is the file in which you whant to dump it.
Then, to use it from Windows Boot Manager, edit c:\boot.ini adding
c:\bootsect.lnx="Linux"
dd if=/dev/hdaX of=/bootsect.lnx bs=512 count=1
where hdaX is the device in which you installed the MBR and /bootsect.lnx is the file in which you whant to dump it.
Then, to use it from Windows Boot Manager, edit c:\boot.ini adding
c:\bootsect.lnx="Linux"
lunedì 29 settembre 2008
Batch Scan and Crop using Irfanview
Windows Batch Script.
Given a folder it will acquire the image with the scanner and crop it in four different parts
@echo off
rem irfanview folder
set ir_view_path=C:\Programmi\IrfanView
rem filename to modify
set filename=%1%
rem irfanview program file
set ir_view=%ir_view_path%\i_view32.exe
rem half of the width
set width=850
rem half of the height
set height=1170
cd %filename%
"%ir_view%" /scanhidden /convert=image.jpg
"%ir_view%" image.jpg /crop=(0,0,%width%,%height%) /convert=1.jpg
"%ir_view%" image.jpg /crop=(%width%,0,%width%,%height%) /convert=2.jpg
"%ir_view%" image.jpg /crop=(0,%height%,%width%,%height%) /convert=3.jpg
"%ir_view%" image.jpg /crop=(%width%,%height%,%width%,%height%) /convert=4.jpg
Given a folder it will acquire the image with the scanner and crop it in four different parts
@echo off
rem irfanview folder
set ir_view_path=C:\Programmi\IrfanView
rem filename to modify
set filename=%1%
rem irfanview program file
set ir_view=%ir_view_path%\i_view32.exe
rem half of the width
set width=850
rem half of the height
set height=1170
cd %filename%
"%ir_view%" /scanhidden /convert=image.jpg
"%ir_view%" image.jpg /crop=(0,0,%width%,%height%) /convert=1.jpg
"%ir_view%" image.jpg /crop=(%width%,0,%width%,%height%) /convert=2.jpg
"%ir_view%" image.jpg /crop=(0,%height%,%width%,%height%) /convert=3.jpg
"%ir_view%" image.jpg /crop=(%width%,%height%,%width%,%height%) /convert=4.jpg
Windows Backup made easy with SystemRescueCD
Quick solution to add an 'open source' automatic recovery option from the windows boot manager.
Steps:
1- Download SystemRescueCD iso from http://www.sysresccd.org/Download
2 - Extract sysrcd.dat, rescuecd, initram.igz and place them on C:
3 - Download Grub4Dos from https://gna.org/projects/grub4dos/ (tested with version
4 - Modify C:\boot.ini adding in the section [operating systems] the statement:
5 - Add the following file to C:\
6 - Resize you C partition and create another one which will contain the backup.
Steps:
1- Download SystemRescueCD iso from http://www.sysresccd.org/Download
2 - Extract sysrcd.dat, rescuecd, initram.igz and place them on C:
3 - Download Grub4Dos from https://gna.org/projects/grub4dos/ (tested with version
grub4dos-0.4.3-2007-08-27.zip) extract the file grldr to C:\4 - Modify C:\boot.ini adding in the section [operating systems] the statement:
C:\grldr="SystemRescueCd"
#======================menu.lst=======================
default 2
timeout 30
# This is a sample menu.lst file for SystemRescueCd
title Create Backup
root (hd0,0)
kernel /rescuecd ar_nowait autoruns=0 setkmap=it docache
initrd /initram.igz
# This is a sample menu.lst file for SystemRescueCd
title Restore Backup
root (hd0,0)
kernel /rescuecd ar_nowait autoruns=1 setkmap=it docache
initrd /initram.igz
# This is a sample menu.lst file for SystemRescueCd
title SystemRescueCd from the NTFS disk
root (hd0,0)
kernel /rescuecd ar_disable setkmap=it docache
initrd /initram.igz
#================================================
#===========================autorun0=============
#!/bin/sh
#Create Backup Script
ntfs-3g /dev/sda2 /mnt/windows
partimage --compress=2 --overwrite --nodesc --batch save /dev/sda1 /mnt/windows/win_backup.bz2
umount /mnt/windows
reboot
#================================================
#===========================autorun1=============
#!/bin/sh
#Restore Backup Script
ntfs-3g /dev/sda2 /mnt/windows
partimage --batch restore /dev/sda1 /mnt/windows/win_backup.bz2
umount /mnt/windows
reboot
#================================================
6 - Resize you C partition and create another one which will contain the backup.
giovedì 21 agosto 2008
Automatic login in Windows XP
Taken from:
http://support.microsoft.com/kb/315231
Quick command:
Start->Execute-> control userpasswords2
http://support.microsoft.com/kb/315231
Quick command:
Start->Execute-> control userpasswords2
mercoledì 9 luglio 2008
Compress / Decompress initrd files
To Decompress:
zcat initrd.gz > initrd
mount -t ext2 -o loop,rw initrd /tmp/
After the modification of the folder structure, to compress again:
gzip -c initrd > initrd.gz
zcat initrd.gz > initrd
mount -t ext2 -o loop,rw initrd /tmp/
After the modification of the folder structure, to compress again:
gzip -c initrd > initrd.gz
Hex Edit using VI
Here are some few commands to edit an hexadecimal file using vi:
vi file.hex
#now editing in vi
[esc] :%!xxd
#now editing file.hex in hex
#find some innocuous string or rcsid
#change the values on the hex side
[esc] :%!xxd -r
[esc] :wq!
#Now have a look on the file just created
hexdump file.hex
Iscriviti a:
Post (Atom)
