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.
What to do when you mess up the setuid bit of all the files from root directory?
You can mess up the access mode of a file if you do a ‘chown -R’ or ‘chmod -R’ over the wrong directory. Well, I did!! This will screw up the setuid bit which can lead to permission problem on some essential utilities, such as mount, dhclient, etc. Read more 
Making the most of unix commands when programming (Part 2) – the awk command
Awk command is one of the most useful unix tools and yet the most (in my view) underrated. It can save you a lot of efforts writing any code. Everyone uses a lot of grep in conjunction with programming but awk can do more than grep in some cases. Read more 
Handy unix commands for debugging
I spend most of my time in my job reading other peoples’ code or kernel source code than writing my own. These code can be scattered into many directories in multiple levels. I constantly have to do ‘find’ and ‘grep’ to trace variable and function names. Typing these commands manually can add up a lot of time. Read more 
Making the most of unix commands when programming (Part 1) – the ps command
With the use of unix commands not only can reduce programming effort, but also if we utilise the them even more, less code is needed. Less code means less bugs. The well known unix tools philosophy is to ‘do one thing and do it well’. All we need is to make the tool doing well for our programs. In this article, I will give some examples in C and Php. Read more 
Guidelines on integrating complex unix command lines into programs
Needless to say, the power of combining unix commands together can break any complicated tasks into challenging tricks. These commands are a great help in programming to offer great short cuts. Less code means less bugs. However, I have seen some code embedded with complex unix command lines used slightly to the extreme. Read more 




