Posts

Using Firefox now, Google chrome trashing my disk :(

I stop using Firefox now, because Google chrome trashing my disk :( (wake up disk too often in laptop mode) To check what is using your disk: stop rsyslog echo 1 > /proc/sys/vm/block_dump watch 'dmesg -T | tail -35 ' Misc: You may want to add commit=600,relatime to / and /home to /etc/fstab Read also: eatmydisk

Mysql on low memory system

This will reduce mysql memory usage on system with low memory, for example 256MB: Edit /etc/mysql/my.cnf [mysqld] .... innodb=OFF default-storage-engine=MyISAM .... service mysql restart

Custom script: set cpu governor to powersave

Custom script to set cpu governor to powersave when using battery, and return to ondemand when plugged cat /etc/pm/power.d/90khad #!/bin/sh batt() { echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo powersave > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor echo powersave > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor echo powersave > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor } ac() { echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor echo ondemand > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor echo ondemand > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor } case $1 in     true) batt ;;     false) ac ;;     *) exit $NA ;; esac exit 0

Daftar applet/indicator di ubuntu

Wah, banyak indicator yang keren2 di ubuntu, lihat di sini: http://askubuntu.com/questions/30334/what-application-indicators-are-available Yang gw install: System Load Indicator (grafik cpu) Dropbox Hardware Sensors Indicator (untuk temperatur)

More laptop power saving, Ubuntu

First, make sure your chipset supports ALPM , my Asus K43SM.401 does vi /etc/pm/config.d/sata_alpm write this line: SATA_ALPM_ENABLE=true Try to plug and unplug your charger To check: cat /sys/class/scsi_host/host*/link_power_management_policy it should read  min_power when on battery power

Tuning Apache for low memory

Set MaxRequestsPerChild to low number, start with 200 This should stop apache growing memory usage and using swap memory.

Auto turn off wifi when cable connected

Script ini akan mematikan wifi secara otomatis, saat koneksi menggunakan kabel (ethernet) aktif. Saat kabel disconnect, wifi akan aktif kembali. Buat file /etc/NetworkManager/dispatcher.d/99khad: #!/bin/sh myname=$(basename "$0") || exit 1 log() { logger -p user.info -t "${myname}[$$]" "$*"; } IFACE=$1 ACTION=$2 case ${IFACE} in     eth0)         case ${ACTION} in             up) nmcli nm wifi off                 ;;             down) nmcli nm wifi on                 ;;         esac         ;;     wlan0)         case ${ACTION} in             up)                 ;;             down)           ...

Clean up apache process

routine script for cleaning up process from script kiddies: /etc/init.d/httpd stop /etc/init.d/httpd stop # my killall does not support -u for a in `ps auxww | grep -r ^apache | awk -F " " '{ print $2 }'`; do kill -9 $a done /etc/init.d/httpd start

Change dota key mapping

This is how to change dota key mapping , for accessing inventory faster. Use xkeycaps to help determine keys F1 = keypad 1 F2 = keypad 2 etc. xmodmap -e "keycode  0x43 = KP_1" xmodmap -e "keycode  0x44 = KP_2" xmodmap -e "keycode  0x45 = KP_4" xmodmap -e "keycode  0x46 = KP_5" xmodmap -e "keycode  0x47 = KP_7" xmodmap -e "keycode  0x48 = KP_8" #key 1 and 2 only: xmodmap -e "keycode 0x0A = KP_1 exclam KP_1 exclam" xmodmap -e "keycode 0x0B = KP_2 at KP_2 at"

Script to backup virtual machines

Prerequisites: - VM must be located on LVM - virsh This is my script (all vm will be backup-ed): #!/bin/sh ############################## VOLGROUP=sugriwa LOGVOLSRC=episode1 ##SOURCE=/home/export/vm TARGET=/home/backup/backupvm ## ##default LOGVOLSNAP=snapvm1 SNAPSIZE=15G ############################## if [ "x$1" != "xY" ] ; then echo $0 Y exit fi mkdir "$TARGET/xml" ALLVM=`virsh list --all | tail -n+3 | head -n-1 |  awk '{print $2}'` for a in $ALLVM; do virsh suspend $a virsh dumpxml $a > "$TARGET/xml/$a.xml" done echo creating snapshot lvcreate -L$SNAPSIZE -s -n $LOGVOLSNAP $VOLGROUP/$LOGVOLSRC for a in $ALLVM; do virsh resume $a done mkdir /mnt/$LOGVOLSNAP mount /dev/$VOLGROUP/$LOGVOLSNAP /mnt/$LOGVOLSNAP echo copying... rsync -ahvx --inplace --progress /mnt/$LOGVOLSNAP/ $TARGET/ umount /mnt/$LOGVOLSNAP rmdir /mnt/$LOGVOLSNAP echo removing snapshot lvremove -f...

Your project contains errors, developing android with eclipse

This is how to fix it: # rm  ~/.android/debug.keystore Then close your project, re-open, clean, build http://stackoverflow.com/questions/4954316/your-project-contains-errors-please-fix-it-before-running-it#_=_

Setup Zram to your ubuntu

Now, there is a easier way to use zram, my attempt: http://superbiji.blogspot.com/2011/01/using-zram-was-compcache.html easier way: http://www.webupd8.org/2011/10/increased-performance-in-linux-with.html

Oracle limit with Zend Db

Sometimes we have problem when using Oracle database, because oracle don't have SELECT LIMIT statement. But from Zend Framework source below, SELECT LIMIT is simulated automatically when we are using Zend Db Select:   So we can use Zend Db Select to create query easily, like this: $select = $db->select()              ->from(array('p' => 'products'),                     array('product_id', 'product_name'))              ->limit(20, 10); $result = $select->fetchAll();

Transaction in Zend Framework

Link: How to Root Galaxy Tab 10.1 the Easy Way

Untuk custom recovery dan rooting, Check this out: http://galaxytabhacks.com/galaxy-tab-10-1-hacks/how-to-root-galaxy-tab-10-1-the-easy-way/

Transfer files MTP using ubuntu (honeycomb android)

Tablet using honeycomb such as Samsung Galaxy Tab, Motorola Xoom Using aafm (beta) https://github.com/sole/aafm Rule for udev: SUBSYSTEMS=="usb", ATTRS{idVendor}=="04e8", ATTRS{idProduct} =="685e", MODE="0666", OWNER="khad" # service udev restart forum: http://forum.xda-developers.com/showthread.php?t=1077377 Using ddms: http://forum.xda-developers.com/showpost.php?p=16623845&postcount=27

Ganti DNS di android

Biar browsing di android nggak lemot, ganti DNS-nya pake aplikasi ini: 1.1.1.1 https://play.google.com/store/apps/details?id=com.cloudflare.onedotonedotonedotone Cara lain (android harus rooted): Contoh: biar bisa buka reddit.com di android Android harus sudah di root Cari dan catat beberapa IP Address ( IN A ) website yg dituju: https://dnsquery.org/dnsquery (Tambahkan www. di query jika perlu) Colokkan handphone ke laptop, pastikan USB debugging ON Dari terminal, masuk ke shell android: # sudo su # adb kill-server # adb shell * daemon not running. starting it now on port 5037 * * daemon started successfully * shell@hammerhead:/ $ Dari dalam shell android: $ su (grant root permission) # mount -o remount,rw /system # echo IP_ADDRESS NAMA_WEBSITE www.NAMA_WEBSITE m.NAMAWEBSITE >> /system/etc/hosts misalnya: echo 198.41.208.143 reddit.com www.reddit.com m.reddit.com >> /system/etc/hosts Reboot android  Buka browser dan bisa browsing ke website tersebut ...

Run 64bit Guest on 32bit Host Virtualbox

Virtualbox is really cool software for virtualization and it is free. Latest version of virtualbox support running 64bit guest, even on 32bit host. See this checklist: Make sure your processor support VT-x (or AMD-v) and 64bit Enable in BIOS: Virtual Machine Technology set option in guest: PAE, IOAPIC, ACPI to enabled And most important thing: set OSType to Ubuntu_64 or Windows_64 (note the _64) Install your guest OS (i prefer using headless and rdp)

Using zram (was compcache)

I've tried compcache but dont get good result: http://superbiji.blogspot.com/2010/12/enable-compcache-in-ubuntu.html But zram seem working fine. Compcache will be included in 2.6.37 kernel, named: zram. But if you want to try it follow this step: Download and install 2.6.36 kernel from here: http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.36.2-natty/ Get compcache source (not tar.gz), if you get compile error see reference below: hg clone https://compcache.googlecode.com/hg/ compcache make cp zram.ko /lib/modules/2.6.36-02063602-generic/updates/ depmod -a Add this to /etc/rc.local: # if you have 2 core modprobe zram num_devices=2 # 500mb each, usually compressed to 80% echo 524288000 > /sys/block/zram0/disksize echo 524288000 > /sys/block/zram1/disksize mkswap /dev/zram0 mkswap /dev/zram1 swapon /dev/zram0 -p 100 swapon /dev/zram1 -p 100 Next, reboot and run big apps like eclipse, 3 virtual machines Reference: http://www.vflare.org/2010/05/compresse...

Enable compcache in ubuntu

Sometimes I'm running a lot of VM? which needs a lot of memory, so i try to enable compcache: vim /etc/initramfs-tools/initramfs.conf #Edit this line: COMPCACHE_SIZE="60 %" update-initramfs -u reboot After enabled, you can see new swap device (ramzswap): cat /proc/swaps Filename Type Size Used Priority /dev/ramzswap0 partition 1229208 0 100 /dev/sda3 partition 2064344 0 -1 http://code.google.com/p/compcache/