Donnerstag, 2. Dezember 2010

edit initrd

If you ever need to edit the initrd file of /boot/ then issue the following commands:

mkdir ~/initrd
zcat boot/initrd-2.6.22.12-0.1-default >~/initrd-2.6.22.12-0.1-default.cpio
cd ~/initrd
cpio -idv <../initrd-2.6.22.12-0.1-default.cpio

The reverse process is doing by this commands:

find . | cpio --quiet -c -o | gzip -9 -n > /boot/imagefile.img

Donnerstag, 23. September 2010

repair cacti database

issue following command as root:
mysqlcheck --auto-repair --databases cacti

Donnerstag, 26. August 2010

solve envi 4.1 segmentation fault

If ENVI 4.1 crashes with segmentation fault then find a old libX11.so.6 file from a working
version and copy it to the directory of your choice and specify this path to LD_LIBRARY_PATH:
export LD_LIBRARY_PATH="/usr/local/lib/private_lib"
export LD_PRELOAD_PATH="/usr/local/lib/private_lib"

then start ENVI and...works

Dienstag, 29. Juni 2010

untethered jailbreak and unlock for iphone 3GS with new bootrom and firmware 3.1.3

The iphone 3GS with new bootrom and firmware 3.1.3 can be jailbreaked and unlocked with following tools:

1) jailbreak it with Spirit from this page:
http://www.redmondpie.com/spirit-jailbreak-fix-for-itunes-9.2/
The link to the software you will find here:
http://rapidshare.com/files/403136973/Spirit.Fix.iTunes.9.2.rar.html

2) unlock the phone with ultrasn0w.
Go to Cydia and add the source http://repo666.ultrasn0w.com
Then install ultrasn0w and everything is done.

Donnerstag, 24. Juni 2010

mount partition of dd image of hard disk

If you did a backup of a hard disk with the dd command then you stored
everything including the partition table.
If you want to mount one partition of this backup only to a folder then you need to do the following:

1) losetup /dev/loop0 /home/proc/file
2) fdisk -lu /dev/loop0 then you will see the partitions and the number of the blocks where they start. If you want to mount the partition number 3 then read the number there. Let's say it is N
3) losetup -d /dev/loop0 (release the loop device)
4) losetup /dev/loop0 /home/proc/file -o $((N*512))
5) mount /dev/loop0 disk

Montag, 31. Mai 2010

1 Tb hard disk appears as 33Mbyte disk on a Gigabyte mainboard

If a 1Tb hard disk that is installed on a Gigabyte motherboard appears to have
a size of 33 Mbyte after some time then do the following:

>hdparm -N /dev/sdc (assuming that the disc appears as /dev/sdc)
/dev/sdc:
max sectors = 1953525168/1953525168, HPA is disabled

write the number that appears behind the slash in the following line:

>hdparm -Np1953525168 /dev/sdc


Then reboot the machine.
The disc has its original size and all data is still there.
Thanks to:

http://www.mail-archive.com/linux-ide@vger.kernel.org/msg16327.html

Donnerstag, 18. Februar 2010

howto encrypt a directory to a file

To encrypt a directory input_directory to a encrypted file do the following:

a) generated a file input_directory_file big enough to hold the data. This file will be the
filename of theencrypted file later. To do this you can use the command dd if=/dev/zero
of=input_directory_file bs=1M count=100. This command will generate a file with 100Mb size.
b) losetup /dev/loop0 input_directory_file
c) cryptsetup luksFormat /dev/loop0 (answer with YES and specify the password twice)
d) cryptsetup luksOpen /dev/loop0 containername
e) mke2fs /dev/mapper/containername (to put a filessystem to the device)
f) mkdir container_dirctory
g) mount /dev/mapper/containername container_directory
h) put all the files and directories inside this container_directory
i) umount container_directory
j) cryptsetup luksClose containername
k) losetup -d /dev/loop0

That's all

Donnerstag, 14. Januar 2010

how to read the database of sleep cycle and how to generate the same plots

1) copy the file /var/mobile/Applications/sleep cycle/Documents/eventlog.sqlite
to your pc.
2) use sqlitebrowser to open the file and to extract the data:
ZINTENSITY contains the data
ZTIME contains the time
ZSLEEPSESSION contains the session number (number of night)
-> the time is given in seconds since 1.1.1970
-> example: array=dblarr(2,200)
array(0,*)=ZTIME
array(1,*)=ZINTENSITY
3) for plotting:
->subtract the time of the first element from all times (remove the time offset)
array(0,*)=array(0,0)
->generate an empty array with the same number of elements as you have seconds
arind=fltarr(max(array(0,*)))
->put your data to that positions where the time was recorded.
arind(array(0,*))=array(1,*)
-> plot the data with plot,smooth(smooth(smooth(at,1001),1001),1001)