Saturday 26 January 2013

Lal bagh flower show

Had gone to the Lal Bagh Republic Day flower show today along with Smitha.  Had a nice time there for a few hours.  Had mango juice, grape juice and cucumber (ಸೌತೆ ಕಾಯಿ) there, served by Hopcoms.  We went by car from home, parked the car at Gandhi Bazaar (~2 km from Lal Bagh) since finding parking near Lal Bagh seems to be a tough task; took an auto from there to Lal Bagh.  While coming back, we went to Roti Ghar at Lal Bagh.  The original plan was to go to Vidyarthi Bhavan, but, since it was overcrowded, went to Roti Ghar.




























Monday 21 January 2013

Snaps near Ganesha temple, Jalahalli

Dad, myself, Smitha and our son had been to attend the Satyanarayana Pooja performed by Raju chikkappa at BEL Pravacana Mandira, Jalahalli on 19th Jan 2013.  Few snaps taken on that day.






Friday 11 January 2013

Changing the author email for git commits

Say you had configured your email with a typo (say, as [email protected], instead of [email protected]), and want to now fix the email in the git logs, you can do this:

git filter-branch --commit-filter '
    if [ "$GIT_AUTHOR_EMAIL" = "[email protected]" ];
    then
        export [email protected];
        git commit-tree "$@";
    else
        shift;
        while [ -n "$1" ];
        do
            shift;
            map "$1";
            shift;
        done;
    fi'

Remember that it is ok to do this if you have not yet shared your commits to the external world.  However, if you have already shared it, it might not be appropriate to do this, since the filter-branch command creates new commit objects (with different SHA ids than the original commits).

Read more about the git filter-branch command at http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html.

Wednesday 2 January 2013

Replace in vim with placeholders


vim allows you to match strings in a file using regexs and replace them.

For example, to replace all instances of "foo" with "bar" in the file, you do:

:%s/foo/bar/g

What's actually more useful, is that we can use \( and \) to capture the values that matched by the pattern and use \1, \2, \3 and so on to put the matched values in the expression to substitute.

So, to swap columns 1 and 3 of a comma-separated file with 3 columns, we can use:

:%s/\([^,]*\),\([^,]*\),\([^,]*\)/\3,\2,\1/