9
Sep
Emacs command line to indent Javascript code and convert tabs to spaces
Part of my project checkin script is to automatically apply coding style and converting tabs to spaces. Here is the command line:
emacs -batch file.js --eval "(custom-set-variables '(js-indent-level 2))" -f mark-whole-buffer -f indent-region -f mark-whole-buffer -f untabify -f save-buffer -kill
Change the value of js-indent-level to any religion of white spaces.
29
Jul
How to extract storage device information (Parte 2 – using lshw and xmlstarlet)
In Ubuntu 10.04, udevinfo is no longer available and I need to write a LiveCD tool to retrieve storage information (such as vendor, size, filesystem, label) from existing partitions (e.g /dev/sda1). So I cannot use the command lines anymore mentioned in my previous blog.
After a day of researching various tools and experiment parsing command line outputs. Eventually, I decide to use lshw to generate all the storage information and output into XML format. Then use xmlstarlet to extract specific device data. Read more 



