The future is already here — it's just not very evenly distributed.

Python – Native Head and Tail Functions

February 12, 2013

I was working on some log processing the other day when I encountered a situation where I wanted to have the python equivilant of Unix’s head and tail commands.

The problem here is that most anywhere you look, Python’s version of tail tends to share the same problems.

  • Read the entire file into memory
  • Iterate over the entire file

Obviously, this can be quite problematic when you have 300mb logs constantly processing. Here is a more efficent version of tail:

This is of course available as a gist as well.

  •   •   •   •   •

notify – GNOME3 Notification Messages from the Terminal

May 12, 2012

So it seems that, while I don’t have a lot of code that would work as projects, I do have a fair bit of code that works as gists.

I posted a new gist I simply call notify which allows you to give custom  messages in the message tray in a programmatic way. I often use it in conjunction with kTimer. I have only tested this script with Gnome 2.x-3.2 but it very well may work in KDE or other desktop environments.

If you find notify useful, please leave a comment!

  •   •   •   •   •

Colour all the things!

March 27, 2012

Like most developers, I use the terminal… a lot.

Because I like colours and am in the terminal more often than not, I have developed somewhat of an obsession for colourizing all the things I can. I have created two scripts which I find myself using with some consistency. They are alternative, ANSI colour friendly implementations of watch and cat. I have created a gist on github for each of them.

I hope you find them as helpful as I do!

  •   •   •   •   •