Archive for January, 2010

How to Merge multiple rows into single rows

What’s an easy way to merge multiple rows into single rows? For example, if I have the following:
$cat file
A
B
A
B
A
B
How can I convert this into:
A B
A B
A B
$awk '{total=total" "$0}NR%2==0{print total; total=""}' file

I want to be able to merge various numbers of rows into single. In the
above example, it’s 2 rows being merged into 1 but what if I need to
merge 3 into 1, such as the following:

A
B
C
A
B
C

to be converted to the following:
A B C
A B C
$awk '{total=total" "$0}NR%3==0{print total; total=""}' file

No Comments

Truecrypt live with Ubuntu and windows

Now the enviorment:

Windows already installed and Truecrypt encrypt the whole disk. and install Ubuntu and keep Windows.

After Ubuntu installed, the Windows disappear.

Reason/Solution: Windows is encrypted with Truecrypt, so Ubuntu can’t detect the system and generate the dual-boot menu.

so we need to use “Truecrypt Rescue CD”, insert it into the computer and restart it. Then it will show: “…Install hiding operating system”

choose “No”, then it will ask your password, input your password and then go to Windows now. default it will boot into Ubuntu.

after boot into Windows. “permanently decrypt” ….then grub-install /dev/sda

we got dual-boot menu. if any better idea to keep Truecrypt with Windows. share your idea. Thanks.

No Comments

Yum and Sphinx

When run yum search xxx, got the following Error
Error Value: database disk image is malformed

A: run the following commands as ‘root’ and one by one
yum clean metadata
yum clean dbcache
yum makecache

Sphinx search for wiki /opt/sphinx/etc/sphinx.conf (my e.g.)

Read the rest of this entry »

No Comments

How to Use Curl Control Home Router

If we need to check your router status, we can use curl to grep some information we need.

My Wireless Router: TP-Link

Command to check who is online:

$ curl –basic –user myuser:myPass http://myrouteip/userRpm/AssignedIpAddrListRpm.htm |grep “what we want”

No Comments

A nice Project USB over IP Network

USB/IP Project aims to develop a general USB device sharing system over IP network. To share USB devices between computers with their full functionality, USB/IP encapsulates “USB I/O messages” into TCP/IP payloads and transmits them between computers.

Official site: http://usbip.sourceforge.net/
Example: http://howtoforge.org/how-to-modify-your-gnu-linux-box-to-serve-as-a-usb-over-ip-server

No Comments

Nagios Tools for Desktop

If you monitor your system with Nagios, then I’d like to share a good desktop tool with you.

Nagstamon is a Nagios status monitor which takes place in systray or on desktop (GNOME, KDE, Windows) as floating statusbar to inform you in realtime about the status of your Nagios monitored network. It allows to connect to multiple Nagios servers.

http://sourceforge.net/projects/nagstamon/

Install the necessary tools firstly on Ubuntu 9.10
$sudo apt-get install -y python-lxml python-gnome2-extras python-gtkmozembed python-eggtrayicon python-gtkspell python-gksu2 python-gdl python-gda python2.5 libgdl-1-3 libgda-4.0-4 python2.5-minimal libdb4.6 libgdl-1-common libgda-4.0-common
$wget http://kent.dl.sourceforge.net/project/nagstamon/nagstamon/nagstamon%200.8.2/nagstamon_0.8.2_all.deb
$sudo dpkg -i nagstamon_0.8.2_all.deb

Enjoy the good tool.

No Comments

Install Skype on Ubuntu 9.10

$wget http://download.skype.com/linux/skype-ubuntu-intrepid_2.1.0.47-1_i386.deb
$sudo dpkg -i skype-ubuntu-intrepid_2.1.0.47-1_i386.deb

Now you get the Skype in your Internet Apps

http://www.medibuntu.org/ is an good place for media players…

No Comments