Wednesday, February 28, 2007

Python distutils MANIFEST

MANIFEST list files included in 'sdist' target of setup.py. Somehow sometimes people forgot to list every important files in here. To solve this, create MANIFEST.in and list those missing files in it.

Just in case I forgot again

MANIFEST.in
include *.txt
include src/*.i

Then rebuild the packages

Monday, February 26, 2007

TRAC & SQLite

TRAC Upgrade
  • trac-admin /path/to/trac/env upgrade
SQLite Save & Restore
  1. sqlite3 /path/to/.db
  2. >.dump
  3. >.output /tmp/dumped-db.sql
  4. > Ctrl-D
  5. sqlite3 /path/to/new.db
  6. >.read /tmp/dumped-db.sql
  7. > Ctrl-D
TRAC Problem with latest updated centosplus (4.4).
  • SQLite support in PHP is conflict with python-sqlite and mod_python. Need to disable it at /etc/php.d/pdo_sqlite.ini (or either remove php-pdo package).

Thursday, February 22, 2007

heartbeat setup

สิ่งสำคัญในการ setup heartbeat2+crm
  1. Permission ของ /var/lib/heartbeat, /var/run/heartbeat ต้องถูกหมด (ดูได้จาก blog เก่า)
  2. ucast ต้องใส่ ip ให้ถูก
  3. ต้อง cleanup resource หนึ่งครั้ง (crm_resource -C -r ดูได้จาก crm_resource -L)

Wednesday, February 21, 2007

สร้าง httpd ssl certificates แบบไม่มี passphrase
  1. cd /etc/httpd/conf/
  2. openssl genrsa -out server.key 1024
  3. make server.crt
  4. ใส่ข้อมูลให้ถูก
  5. mv -f server.key ssl.key
  6. mv -f server.crt ssl.crt
  7. service httpd restart

Tuesday, February 20, 2007

Important files for heartbeat

Important files for heartbeat that need to have hacluster:haclient ownership
/var/run/heartbeat/ccm
/var/run/heartbeat/ccm
/var/lib/heartbeat/crm
/var/lib/heartbeat/pengine
/var/lib/heartbeat/cores/hacluster
/var/lib/heartbeat/cores/hacluster/*

Monday, February 12, 2007

Link a SVN repository with others

http://weierophinney.net/matthew/archives/132-svnexternals.html

Wednesday, February 07, 2007

Setting up drbd for ROCKS

อืม... ถ้าจะใส่ drbd ลงใน NPACI Rocks สิ่งที่น่าจะทำก็น่าจะมี
  1. Setup /etc/drbd.conf ให้ถูกตั้งแต่ตอน
    1. กำหนด label ใน replace-auto-partition
    2. cat /proc/partitions
    3. ไล่ทีละอัน หาว่าอันไหนมี label ตรงตามชื่อที่กำหนดไว้
    4. ลบออกจาก fstab หลังจากลงเสร็จ
    5. สร้าง /etc/drbd.conf โดยอิงตาม device ที่หาเจอ
  2. เริ่ม drbd (/etc/init.d/drbd น่าจะทำให้)
  3. ใส่ post-drbd ใน /etc/rocksconfig.d/ ให้เรียก drbdadm -- -do-what-I-say primary all ที่เครื่องที่ควรจะเป็น primary

Friday, January 19, 2007

My experience with Asus WL500GP

หลังจากได้เล่น ASUS WL500GP (Wireless Router + 4 ports LAN + partial ADSL support, 8MB Rom, 32MB Memory) มาสองวัน คงต้องบันทึุกสิ่งที่ทำซะหน่อยเดี๋ยวจะลืมว่าทำอะไรลงไปมั่ง
  • OpenWRT - Firmware ตัวแรกที่ลองลง โดยรวมๆแล้วดีมากเลย เล็ก feature ครบ package เพิ่มเพียบ แต่จะเน้นว่าให้ลง package อื่นเพิ่มเอง แนะนำว่าถ้าลง X-wrt ไปด้วย (เป็น package เพิ่มเติม แก้ web interface เป็นหลัก) จะได้ web interface ที่สวยและดีมากเลย (มี real time monitoring บนเวปที่เป็น svg ด้วย) ข้อเสียคือ ใช้ USB2 แล้วช้าครับ เหมือนจะบั๊ก
  • Oleg's Firmware - Custom firmware จาก original firmware ของ asus ตัวนี้จะดีตรงที่ได้ feature ทุกอย่างของดั้งเดิมมาด้วย แต่แก้ลำบาก ตอนที่ลองใช้นี่เหมือนว่า jffs จะใช้ไม่ค่อยจะได้ แถมไม่มีการทำให้แบบอัตโนมัติด้วยคงต้องโมเอง เน้นว่าแก้อะไรให้ใช้ flashfs save file เก็บไว้แล้วมันจะโหลดกลับมาทีหลัง มี package ให้ลงเพิ่มเยอะพอสมควร ข้อดีอีกอย่างคือได้ ntfs แถมมาด้วย (แต่เขียนไม่ได้นะ)
  • dd-wrt - ณ ตอนนี้เป็น firmware ที่ยังใช้อยู่ จะออกแนวคล้ายๆ Oleg คือลงปุ้ปครบหมดเลย ตัวใหญ่พอๆกัน (3.5M ได้ OpenWRT แค่ 1.6M เอง) แต่เหมือนจะอยู่ตรงกลางระหว่าง Oleg กับ OpenWRT คือแก้ให้มี JFFS ได้ ลงนี่นั่นเพิ่มได้ง่ายพอควร package compat กับ openwrt ด้วย (แม้กระทั่ง kernel module) ที่สำคัญ USB2 มันเร็วใช้ได้แฮะ (ราวๆ 6-7MB/s hdparm ได้ 90MB/s) แต่กำลังสงสัยว่าเป็นเพราะต้อง mount แบบยาวๆหรือเปล่า (mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt แทนที่จะเป็น mount /dev/sda1 /mnt) หรือว่าจริงๆ OpenWRT มันก็เร็วได้หว่า
  • NSLU2-linux - อันนี้ไม่ได้เกี่ยวอะไรโดยตรงกับ WL500GP NSLU2 เป็น NAS Device ของ Linksys ซึ่งเป็น Linux เหมือนกัน เข้าทำนองเดียวกับพวก wrt นี่แหละ แต่จุดสำคัญคือมันใช้ CPU คล้ายๆกับพวก WRT ทำให้มีแพกแกจย่อยที่ support ทั้ง OpenWRT, Oleg, dd-wrt ออกมาด้วย package ย่อยส่วนใหญ่ก็มาจากโปรเจ็คนี้แหละ (แต่ๆละตัวใหญ่ๆทั้งนั้นเลย ต้องเสียบ flash ทิ้งไว้ถึงจะลงได้จริงๆ)
โดยรวมๆแล้วสนุกดีเหมือนกันเจ้า router ตัวนี้ แถมน่าจะใช้ประโยชน์ได้เยอะเลย น่าเสียดายขาดพอร์ต adsl ไปแต่ใช้คู่กับ billion bipac ที่แถมมากับ true ก็โอเคนะ

Wednesday, January 10, 2007

Sun freeware

กันลืมครับ (ลืมไปทีแล้ว กว่าจะรื้อฟื้นได้)

ซอฟต์แวร์พวกฟรีๆทั้งหลายบน SUN สามารถหาได้ที่ www.sunfreeware.com (mirror ที่ http://www.sunfreeware.com/ftp.html) ให้ดาวน์โหลดโปรแกรม pkg-get มาก่อน จากนั้นติดตั้งโดย
pkgadd -d BOLTpkgxxx.gz
ถ้าจะดูชื่อ package อื่นๆใน SunOS ก็
pkginfo
พอได้ pkg-get มาแล้ว ให้แก้ /etc/pkg-get.conf ให้ใช้ mirror อื่นๆที่มันเร็วกว่า เสร็จแล้วเวลาจะดาวน์โหลดโปรแกรมฟรีจะทำคล้ายๆ yum, apt
pkg-get -i <ชื่อโปรแกรม>
สั่ง
pkg-get -a
เพื่อดู list รายชื่อโปรแกรมได้

Tuesday, October 17, 2006

Remove node from gfarm 1.3

This instruction apply to Gfarm 1.3.1 using Postgresql backend metadata storage only

1. Remove the node from your cluster. Ex: For NPACI Rocks 4.2
insert-ethers --remove compute-0-7
2. Use psql to access gfarm database. Make sure to change the port number to the correct port. Use 'ps auxw | grep postmaster' to find the port number
psql -p 10602 gfarm farm
3. From psql prompt, input
DELETE FROM filesectioncopy WHERE hostname='compute-0-7.local';
4.Exit from psql. Now the node has been removed permanently from database. Remove it from gfarm now.
gfhost -d compute-0-7.local
That should be all.

Monday, January 16, 2006

5. LVS: The ARP Problem

Another LVS note, in case I would forgot this. This is from http://www.austintek.com/LVS/LVS-HOWTO/HOWTO/LVS-HOWTO.arp_problem.html

5. LVS: The ARP Problem: "2.4.26 and 2.6.4 will come with 2 new device flags for tuning the ARP stack: arp_announce and arp_ignore. All IPVS like setups can use arp_announce=2 and arp_ignore=1/2/3 to solve the 'ARP problem' with DR/TUN setups. These flags are going to replace the 'hidden' functionality which does not work well for directors when they are changing their role between master/slave for a particular VIP. The risk is that other hosts can probe for VIP using unicast packets for which the hidden flag always replies. I'll continue to support the hidden flag for 2.4 and 2.6 to help existing setups but switching to the new device flags (or other solutions) is recommended.

Documentation is in the 2.6 kernel docs (linux/Documentation/networking/ip-sysctl.txt).

arp_ignore: 1 - reply only if the target IP address is local address configured on the incoming interface. if eth0/arp_ignore=1 then all IPs on eth0 are replied, all others (on lo) are not."

Friday, January 13, 2006

Sunday, December 11, 2005

Save Mozilla profiles and mail and migrate to another machine

Mozilla profiles are stored at C:\Documents and Settings\\Application Data\Thunderbird\Profiles by default. There will be a random-named directory inside the Profiles directory. That's our profile directory. Save it somewhere (including all mails) and move it to another machine.

In another machine, install TB and then goes to the Thunderbird directory in Application Data. Open profiles.ini and replace [Profile0] section with

[Profile0]
Name=default
IsRelative=0
Path=D:\Documents and Settings\\Application Data\Thunderbird\Profiles\8c9mmh0q.default


In this case, I place the old profiles at D:\ so that it will not ever lost again.

Now, restart Thunderbird. This time thunderbird might crash, dont' worry. Just remove all extensions and re-install it and everything should works fine.

Monday, September 26, 2005

Backing up a DVD to AVI with merged subtitle using Mencoder

  • Encode Audio
    • mencoder vob_03_005t.vob -ovc frameno -oac mp3lame -o frameno.avi
  • Encode Video 1st pass
    • mencoder vob_03_005t.vob -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1973:vhq:vqmin=2:vpass=1:autoaspect -oac copy -o /dev/null
  • Encode Video 2nd pass
    • mencoder vob_03_005t.vob -ovc lavc -sub subtitle.srt -lavcopts vcodec=mpeg4:vbitrate=1973:vhq:vqmin=2:vpass=2:autoaspect -af volumn=10db -oac copy -o video.avi