Simple git blame function to follow C/C++ functions

function git_blame_fn() {
    if [[ $# -lt 2 ]]; then
	echo "Insufficient arguments."
	echo -e "\e[1mUsage:\e[0m $FUNCNAME <fn_to_blame> [options] <src_file>"
    else
	local fn=$1
	git blame -L "/[a-zA-Z0-9_*]\+ \+${fn}/,/^}$/" ${@:2}
    fi
}

Some mplayer -slave foo

I am an extremely lazy person. That means I am always looking for ways
to do things quicker, easier and with the least bit of effort. This
incessant obsessive search for alternate solutions often leads to some
quite cool discoveries.

This particular post is to share with others as lazy as myself who
hate to get off their bed to change the movie or volume of the mplayer
instance playing on the desktop when you have your laptop lying next
to you. Of course this is easily solved with some money if you buy an
LIRC remote (mplayer supports it). But the challenge there is to
actually find a decent remote that works with PCs (damn you
consoles!). Hope this keeps you on your bed longer, so here it goes:

Read more

color-theme-dark-emacs

How it started

I recently made an emacs theme with dark looks, thought it would be good to share with others. I love the look and feel of emacs when run inside the terminal. So I was looking for a way to get a dark look for my emacs when I was using the gui. A helpful emacswiki user (ZWZ) pointed me to a theme he had worked on, so I started off from there.

Mostly I wanted a theme that would make the transition from the terminal to gui seem seamless.

How to use?

Just install color-theme from http://www.nongnu.org/color-theme/. And go ahead and grab dark-emacs from my github repo. Put it in, say ~/.emacs.d/, and call it from your init file (e.g. ~/.emacs) like this,

Read more

Using OpenOffice.org Impress templates

I recently gave a talk presenting my research progress at the University. Everyone in my lab uses beamer and LaTeX, I am however of the opinion LaTeX is very restrictive with its formatting when it comes to presentations. For documents the structured approach of LaTeX is awesome. But for presentations I would rather have the flexibility of a point-and-click interface. Gives you a lot of room to present things the way you like.

So now to the object of this post, I chose OpenOffice.org with the ooolatex plugin as my office suite of choice. I ended up creating a template to suit my needs, and this post is just to document my thoughts/reasons behind the design.

Anyone can download and use the template from here here as long as they agree and adhere to this Creative Commons license.

Read more

History is made!

1TeV beam @ the LHC, officially the highest energy beam in the world.

1TeV beam @ LHC

Forgotten casualties of `war’

If only they knew they would be forgotten and disowned so easily, they probably wouldn’t have done it. I am referring to the terrorists who were killed in the recent Mumbai terror attacks in India. The bodies of the terrorists are still lying at the morgue. Their country has refused to take the remains back, and the local Muslim community refuses to let them be buried at their cemeteries, as they feel the terror attacks were misguided. This was recently reported by the BBC.¹

What this led me to think, would they have done what they did if they knew they would be in this predicament later on? Weren’t these naive young individuals led to believe they were about to become `martyrs’, never to be forgotten in the history of the sub-continent? Usually the actual terrorists are regular people who don’t know better, and have been misrepresented the truth. If only we could get this to them before the soothsaying `holy men’ preaching violence against humanity to serve their convoluted purposes.

I believe the correct information is extremely powerful when it comes to dealing with misunderstanding between people. In this particular case we could have done nothing to prevent this (other than better patrolling of course), but we do have a serious internal security problem. Isn’t increased awareness the way to go ahead? And the first step to awareness is unaltered education. I add that adjective as not too long in the past we had a government who wanted to rewrite the text books, wanted to control what was being taught in the schools. Although we have survived that, we still haven’t made much progress over making education more accessible throughout the country. The free mid-day meal programme has largely been a failure due to rampant corruption at the various ranks of the government. I believe once a self-consistent system of basic education is in place, which is free from any external tampering and is self-sufficient we could be on the right track.

Once the information is out there, the common man/woman can be trusted to make their own `informed’ decisions. After all don’t you recall what Swamiji said?

Education is the manifestation of the perfection already in Man.

¹ http://news.bbc.co.uk/2/hi/south_asia/8370017.stm

Born free

Since I came to Vancouver, I got to interact with a lot of students from parts of the world where freedom has a different meaning. I realised we Indians don’t appreciate enough how we have been raised. Neither do we realise how things are in other parts of the world. Let me elaborate some more.

The right to free speech has been so ingrained in our daily lives through the intensely active Indian media (although their activity is not always in the right direction) that we don’t even notice it. When it comes to expressing our opinions, we are always at the front. Politicians actually need to worry about how to keep their dirt behind closed doors. I believe all of this freedom to think and express has helped us evolve the idea of right and wrong in two distinct ways,

  • permitted under the law.
  • acceptable as a society.

We also realise that they need not overlap. Although that is not ideal, we try to reach a resolution through debates in either the media, a court of law or the parliament. This has a big implication for us as a society, it is never acceptable for an entity to circumvent the law even when justified by an argument such as, for the greater good. When individuals grow up in an atmosphere with restricted freedom, one doesn’t appreciate this subtlety and often justify breaking the law arguing its for the greater good and whatever collateral damage that comes with it is acceptable. In their mind their personal limits of acceptability is the only constraint on choice.
Read more

Follow

Get every new post delivered to your Inbox.