Monday, March 18, 2013

remove old linux kernel in ubuntu

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y remove

Thursday, May 31, 2012

To make Emacs recognize cuda (.cu) files in c++ mode

Much simpler to just put following in your .emacs file: (add-to-list 'auto-mode-alist '("\\.cu$" . c++-mode)) Or alternatively, on a per .cu file basis, you could say just put following in the first line of your .cu files: // -*- c++ -*-

Wednesday, August 19, 2009

Disable the annoying bell sound in bash

In bash, it's common to take the advantage of the "Tab" key helping you to auto-complete the command. Somehow, it will create annoying bell-sound when there are many matches and ...

So, how to disable it. Edit your ~/.inputrc, put something like
set bell-style none
Restart bash, no sound any more!

This applies to bash in both Linux and Mac OS X.

Wednesday, July 8, 2009

Emacs common commands

Search and Replace:
M-x then replace-string RET your_search_string RET your_replace_string

Wednesday, December 17, 2008

Ganglia tricks

Ganglia is a powerful monitoring tool for clusters. Some tricks:

1) remove dead node
try to restart gmond and gmetad.
in /etc/gmond.cong, try to set host_dmax=3600 (sec) in globals.

2) two clusters in one subnetwork
for gmetad to collect data from corresponding cluster (not the other), the trick is to set the TCP/IP port for these two clusters to be different. For instance, the default port is 8649. You can set the second one as 8648. Then, in the server with web frontend, edit gmetad.conf, and put something
data_source "Cluster1" c1_headnode:8649
data_source "Cluster2" c2_headnode:8648
to show all info in one web interface.

Wednesday, December 3, 2008

Create software RAID with mdadm

Here, I will briefly list the steps to create a software RAID5 with mdadm.

1) use "fdisk -l" to check the available hard drives. In my case, I will allocate 4 drives: /dev/sdb, to /dev/sde.
2) to create partitions on raid drives, "fdisk /dev/sdb"; "n->p->1" to create a new partition, /dev/sdb1, "t" to change partition type, use code "fd" to set it as Linux raid autodetect. Do the same for the rest drives.
3) to create the raid "mdadm --create /dev/md0 --chunk=64 --level=raid5 --raid-devices=4 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1". And it will report that /dev/md0 is created and started. (note that it's md0, 0 as number zero, not letter o).
4) "cat /proc/mdstat" and wait for the reshaping process to complete. It will take hours, so don't wait, come back later. After this is done, continue the following.
5) to format the new device "mkfs.ext3 /dev/md0". It will also takes a little while to complete.
6) create a mount point and mount /dev/md0 there. You can also edit /etc/fstab to mount it automatically next time.
7) "mdadm --detail --scan > /etc/mdadm.conf" to save the raid configuration,
8) use "mdadm --detail /dev/md0" to check raid status. also "smartctl --all -d ata /dev/sdb" to check the SMART status of each hard drive.

Emacs problem in Cygwin after rebase

In Cygwin, in order for grace (xmgr) to work, you need to rebase (google it for the guide). But after rebasing, emacs stops working: it hangs there and costs all the CPU. The solution is to reinstall libncurses7. Yeehooo....!