Combining ack-grep and xargs

Gotta love the command line..

I use ack-grep a lot and really, really like it. Kudos to the author and to the maintainer who takes care of the ubuntu package πŸ™‚

Sometimes though I was missing grep‘s --exclude feature that allows me to ignore certain paths while searching.

There are occasions where I e.g. want to see calls to a certain function in the code base but I am not interested in tests. Today I found an (embarrassingly) easy way to get that behaviour using xargs:

$ find . -name \*.py | grep -v tests/ | xargs ack-grep -C 3 -w 'Message\('

The snippet above first accumulates the paths of interests, then filters them and finally lets ack-grep loose on them.

Ta-da! There you go πŸ™‚

My new “baby laptop”

I am using a MacBook Pro for roughly 10 months now and I am generally very happy with it. Nevertheless, I like experimenting and playing with other operating systems, primarily with various linux distributions and with members of the *BSD family.

Running Ubuntu or FreeBSD in a virtual machine (using VMWare’s fusion or Parallels desktop) is a good way to get a first impression of such a system but at some point you will want real hardware. I reached that point with Ubuntu when I took an interest in hard disk encryption (why you should encrypt your hard disk).

It just so happened that around that time Aldi (a German retailer) had a nice 12 inch subnotebook on offer. Aldi was targeting the female clientele (the notebook was even adorned with rhinestones etc.) which resulted in a 100 Euro price markup. The system was still a very good value for the money, however, and I even managed to get my hands on the black model πŸ™‚

I booted the system up (it had Windows Vista Home Premium pre-installed) in order to take a backup of the system in case I had to restore the original state (prior to sending in it for service for example).

Vista was atrocious, totally crippling the poor thing. I mean, it was horrible, even the simplest interactions or commands took a ridiculous amount of time to complete.
Anyway, I managed to take a snapshot of the hard disk, wiped it clean and installed Ubuntu-7.10.

After running Vista on the box for a few hours, Ubuntu was a relief πŸ™‚ it felt very snappy and was generally performing very well. I could do all my development work on the notebook without any problems.

I thought that was very cool πŸ™‚ I finally had a second box, a “baby laptop”, I could use for my experiments. Having two laptops may sound a little bit excessive unless you tamper frequently with all sorts of operating systems. You can keep one machine in a “stable” condition and do all the proper (money generating) work on it while totally rebuilding the other.

I am a slightly paranoid person πŸ™‚ and like to have as much security on my machines as I can get. I hence wanted to install Ubuntu with full hard disk encryption but more on that topic in a forthcoming article..