Floating point arithmetic using bc

March 16th, 2009

The bc shell utility that is available on most UNIX/Linux distributions defaults to integer arithmetic (i.e. throws away anything after the comma). To prevent this, you can set the “scale” option in bc. E.g., the following command will return 3.333: echo “scale=3; 10/3″ | bc


How to insert the output of a command in VI

February 27th, 2009

To insert the output of a command (e.g. ‘ls’) below the cursor, type: :r !ls or :read !ls


How to insert the contents of a file in VI

February 27th, 2009

To insert the contents of a file called /tmp/myfile.txt below the cursor, type: :r /tmp/myfile.txt or :read /tmp/myfile.txt


Geek humour. So clever I’m an idiot.

February 26th, 2009

The sad things is this actually happened… Credits: xkcd