February 27, 2013

vimdiff ignore empty lines

Add this to the end of your .vimrc file to make vimdiff ignore empty lines:

set diffopt+=iwhite
set diffexpr=MyDiff()
function MyDiff()
    let opt = ""
    if &diffopt =~ "icase"
        let opt = opt . "-i "
    if &diffopt =~ "iwhite"
        let opt = opt . "-w -B " " vim uses -b by default
    silent execute "!diff -a --binary " . opt .
                \ v:fname_in . " " . v:fname_new .  " > " . v:fname_out

February 25, 2013

Thinkpad T530 Ctrl-Alt-Break for Remote Desktop Full Screen

Thinkpad T530 does not have the "break" key. Use "Fn-Alt-B" will generate "Break" key code.

So to send Ctrl-Alt-Break, just do Ctrl-Alt-Fn-B

February 8, 2013

diff ignore files only in one directory

diff -bBur old_dir/ new_dir/ | grep -v "^Only in" > my.diff

February 5, 2013

How to add a upstart task on RHEL6

Suppose the application you want to start is called myapp.

Become root and create a file under /etc/init/myapp.conf

start on stopped rc RUNLEVEL=[2345]

        cd /home/me/myapp
        ./myapp -i /home/me/myapp/system.ini
end script

Run "initctl start myapp" to start the app.
Run "initctl status myapp" to see the status.
Run "initctl stop myapp" to stop the app

Keep in mind that myapp should not daemonize itself. Upstart will do the daemonize part.