Mar 6 2012

Never forget your history

As in all things, it’s important to remember what happened before so a) we know how we got here and b) we know what to do going forward.  Now, this is a good life lesson, but for the purposes of this post, I’m actually talking about the history of commands you type at your bash prompt.

Continue reading


Jan 25 2012

Money in politics

Recently there was a Freakonomics podcast that argued more money spent during a political campaign does not equate to more success for that campaign.  I cannot refute their premise because a) I’m sure the statistical analysis they used is very rigorous and b) it ignores two very important other questions.

1. How successful are State or National elections that do NOT spend millions of dollars (i.e. “Can a poor guy actually win an election?”)

2. Do politicians alter their policies and/or provide consideration to political donors once they’re in office?

3. If question 2 is true, what is net financial gain for those altered policies?

Continue reading


Sep 13 2011

Better shell searching and replacing

If you’ve been working with the Unix command-line for any length of time, you likely know about using ‘^’ to replace some part of the previous command with new text. Here’s a typical example

 $ ls dir-09-14-2011/*.log
 [lots of output here]
 $ ^14^13
 ls dir-09-13-2011/*.log
 [logs of output here]

This works fine when you only want to replace one instance of what you’re working with, but what do you do in this example?

 $ mv dir-09-14-2011 backup-09-14-2011

If you try the same trick this time, you’ll get this.

 $ ^14^13
 mv dir-09-13-2011 backup-09-14-2011

Not what we want. What’s a budding command-line hacker to do?

Continue reading


Aug 17 2011

Pausing shell one-liners

Let’s say I’ve got a bunch of data i want to review one segment at a time.  My typical way of going through and doing something to many things in sequence would involve a for or while loop.  For the moment, consider a file named ‘stuff’ that contains a filename and a particular phrase on each line.  I want to see what lines in each filename match that particular phrase.  There could be many more than one, so I want to be able to separate the lines and phrases.  So, here’s how I’d typically go about that.

Continue reading


Jul 26 2011

Escaping life as expressed in ’80s song lyrics

I like movie soundtracks.  It tends to expose me to several artists I wouldn’t otherwise have known and the general tone and theme of the music is similar, so if I know I like a few of the songs, it’s a good chance I’ll think positively about the rest.  Growing up I was a big fan of the “Pretty in Pink” soundtrack.  Not only did it express my teenage angst much more coherently than I was able to at the time (and, to be honest, probably better than I could now), it was my first exposure to The Smiths, The Psychedelic Furs, Echo & The Bunnymen and New Order.  Lots of bands who influenced later alternative rock and bands that opened my eyes to a world of music beyond the Classic Rock I’d listened to up until that time.

One of the songs I gravitated to in particular was “Wouldn’t it Be Good” by the Danny Hutton Hitters (covering Nik Kershaw).  Growing up, I constantly saw many other people’s lives and thought “Wouldn’t it be good to be in their shoes, even if it was for just a day”?  They have to have it better than I do. Their life seems so easy.  Hearing that song again this weekend, I realised I don’t really have that desire anymore

Continue reading


Jul 14 2011

Smarter Grepping (by using ‘awk’ instead)

I recently had cause to search through some mail log files.  I was trying to do some correlation and had gotten the transaction identifiers (TIDs) used for the individual mails I was interested in.  The difficulty was, these transaction identifiers didn’t give me the initial connection information, just the specific transaction within the connection.  I also wanted the connection information to, so it seems like an easy problem: use the connection identifiers (CIDs) and grep on that.  This too ran into some trouble because each connection could have multiple transactions within it and if I grep on just the CID, I get all the transactions, not just the TID I’m looking for.  This might not be a big deal if I’m dealing with a connection that has a dozen or so transactions associated with it, for example.  But some of the connections had literally thousands of transactions.  Sorting through all of those other transactions was much too much of a pain to deal with.  If only there was a way to tell grep “Grep for the CID in the file as long as it a) has the specific TID I’m looking for or b) doesn’t have any TID at all.”  Sadly, there’s not. . . but there is a way to do that in awk!

Continue reading


Jun 19 2011

I always write programs three times

I’ve had a truism for a while that I write programs three times: the first time to get it working; the second time to add in the features I didn’t realise I needed the first time through; and the third time to make the program scalable and maintainable long-term.  In point of fact, I often go back several times after I finish writing a program, but there are three major re-writes.  As an example of this, let’s go through a program I recently began and follow the evolution of that program.

NOTE: The ‘code’ commenting in the default WordPress kinda blows… or I just don’t know how to use it. But, I apologize for the lack of proper code indentation and will rectify that ASAP.

Continue reading


Jun 14 2011

“What’s that, some kinda Nazi word?”

Christian Boone wrote a piece for the Atlanta Journal Constitution titled “Is it OK to take pleasure in LeBron’s pain?“  In it, he says that folks who are happy LeBron failed are engaging in Schadenfreude.  I disagree and wrote Christian an e-mail with a few questions (which I replicate below)

Continue reading


Jun 12 2011

Uplifting reading

One of the primary benefits of getting an iPad is the ability to read eBooks. I like to read when I can, but carrying around the books tends to be a pain. With the iPad, I have access to millions of books without having to add millions of pounds to my bag. A big win. To take advantage of this newfound reading windfall, I decided to read the “Uplift” series of books by David Brin. What follows are my (spoiler-free) thoughts on the series.

Continue reading


Jun 7 2011

IM Conversation of massive importance and nerdiness

Me: As long as we know why the differences are there in the audit, it’s not a big deal.

[time passes]

Scott: ack.

Me: ack?

Scott: ack = acknowledged

Me: I didn’t sen a syn-ack packet to require an ‘ack’ be sent to me. . . . don’t you know  your three-way handshake? ;-)

Scott: I don’t want to hear about you and your “three-way” anythings!

Scott: FIN, FIN, for the love of god FIIIIIIIIIIINNNNNNNNN!