1. A Template for Python Unix Utilities

    One of the most often read postings on this blog is the one about my getopts-enabled shell script template. So I figured, a similar template in Python would also be useful. Like the shell script, it's quite trivial, but it might still save some time.

    The template is an example …

    read more
  2. Quick Tip #3: Creating Histograms in Python

    Since Python 2.5, creating histograms has become easier. Instead of dict, we can now use defaultdict which is similar in behavior to awk's associative arrays. Instead of raising a KeyError for undefined keys, defaultdict adds a user-defined item and returns it.

    I'll demonstrate this with a simple program that …

    read more
  3. Transcoding Files to Ogg Vorbis

    I've got a nice MP3 player from Samsung with 2 GB of flash memory. That's very little and I can never decide which files to keep and which to delete. Fortunately, the player also supports Ogg Vorbis files that require less space for the same quality. To make the most …

    read more
  4. Using ReStructured Text with WordPress

    Writing long documents in a browser input box isn't the most pleasant thing to do. The WordPress builtin editor makes things even more inconvenient by forcing you to write your articles in HTML. It would be pretty cool if you could edit articles in a simple, readable format using your …

    read more
  5. Map/Reduce in Python

    My interest in Grid Computing over the last weeks begins to show. After reading the Google MapReduce paper, I tried my fingers on a client side toy problem.

    For formatting purposes, I was interested in the size of the longest string in a sequence. There are lots of ways to …

    read more
  6. Controlling Firefox via Command Line

    Mozilla-based browsers like Firefox have inherited a useful feature from the good old Netscape Navigator: Controlling a running browser instance via the command line. Using command line options, you can open URLs or files inside your browser window without having to enter them in the address bar.

    Suppose you're working …

    read more
  7. Controlling Rhythmbox using D-Bus

    On GNOME desktops, the D-Bus IPC standard has superseded the CORBA-based approach. Using D-Bus, the operating system can notify the desktop about hardware changes and applications can communicate with each other in a standardized, simple manner. Using signals it is also possible to get a notification in case there are …

    read more
  8. Line Editing for the Python Interpreter

    The interactive python interpreter is a highly useful tool. When writing python code, I always run it in a terminal to test things and to access the documentation. Unfortunately, the built-in line editing capabilities are limited: There's no history, tab-completion, or other advanced editing features that shells like bash provide …

    read more

social