Wednesday, May 27, 2009

Mengendalikan Proses Rakus CPU Di Linux

Kalau kita memakai laptop yang memiliki CPU multi core, lalu ada proses yang menghabiskan CPU, ada cara agar suhu CPU kita tidak melejit: memaksa CPU bekerja pada clock yang lebih rendah. Tapi bagaimana agar proses lain yang kadang perlu CPU bekerja secepat mungkin tidak ikut direm? Kita bisa gunakan kombinasi schedtool dan cpufrequtils.

# proses dipaksa hanya berjalan di CPU1, -a 0x1 untuk memaksa ke CPU0
$ sudo schedtool -a 0x2 PID_proses_rakus
# atur governor clock CPU1 ke userspace
$ sudo cpufreq-set -c 1 -g userspace
# paksa clock CPU1 maks 1.2GHz
$ sudo cpufreq-set -c 1 -u 1.2g

Thursday, May 21, 2009

Continuing Broken rsync

$ ls -lah|grep nanggar
-rwxrwxrwx 1 root root 675M 2009-05-04 02:20 nanggar-alternate-i386.iso
-rwxrwxrwx 1 root root 675M 2009-05-04 03:26 nanggar-cdlive-i386.iso
-rwxrwxrwx 1 root root 334M 2009-05-20 18:22 .nanggar-cdlive-i386.iso.ThN6oe

$ dd if=nanggar-cdlive-i386.iso of=2nd-part bs=1M skip=334
$ mv nanggar-cdlive-i386.iso nanggar-cdlive-i386.iso.prev
$ mv .nanggar-cdlive-i386.iso.ThN6oe nanggar-cdlive-i386.iso
$ cat 2nd-part >> nanggar-cdlive-i386.iso
$ rsync -avP cdimage.blankonlinux.or.id::cdimage/livecd-harian/current/nanggar-cdlive-i386.iso .
Why does it matter? Because we still need old, same parts from previous iso to prevent rsync redownload them again. But how to force rsync to know that old part was already downloaded? By putting them into the same iso of course.

Old iso consists of two parts: O1 and O2. New iso consists of two parts: N1 and N2. N1 has been downloaded into dotfile, while N2 is to be checked against O2, and we only need N2 vs O2 difference. So we need to create temporary iso, which consists of N1 (=dotfile) and O2, to enable rsync delta algorithm.

I hope this idea is clear enough.

Tuesday, May 05, 2009

Ternyata Kadang Masih Perlu Image Floppy

Untuk membuat berkas image floppy berukuran 1.44MB:

$ mkfs.msdos -C floppy0.img 1440
Lalu agar bisa diisi, di-mount loopback saja:
sudo mount -o loop,uid=1000 floppy0.img /mnt/floppy
Baru salin-salin berkas:
$ cp /path/to/source/file /mnt/floppy
Jangan lupa dilepas kaitnya sebelum dipakai:
$ sudo umount /mnt/floppy
Daftarkan di VirtualBox:
$ VBoxManage openmedium floppy floppy0.img

Sumber:
Create mount and copy floppy disks images under linux


menunggu komen hari gini masih pake floppy? :D