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.
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
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
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
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
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