Tag Archives: quick tips

Quick Tip #6: Triggering Actions on File Close

Sometimes it’s useful to trigger an action after a file is closed. Suppose you started a lengthy download on your notebook and you want to suspend it as soon as the download is done. There are several ways to achieve … Continue reading

Posted in shell | Tagged , , , | Leave a comment

Quick Tip #5: Navigating in Source Trees

I often move around in checked out Subversion or Git source trees on a Bash command line. Directory structures tend to get quite deep (especially in Java projects), so one problem keeps coming up frequently: Changing back to the base … Continue reading

Posted in shell | Tagged , , | Leave a comment

Quick Tip #4: Sorting Large Files

With traditional Unix sort(1), the size of the files you can sort is limited by the amount of available main memory. As soon as the file gets larger and your system has to swap, performance degrades significantly. Even GNU sort … Continue reading

Posted in shell | Tagged , , , , | 2 Comments

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 … Continue reading

Posted in python | Tagged , | 2 Comments

Quick Tip #2: Set Operations Using Shell Tools

Everybody knows that Unix shell utilities are powerful. Even though they’re text-based, you can build a lot of useful things outside of the text domain. Today I’ll show you how to implement set operations. All we need are sorted files … Continue reading

Posted in shell | Tagged , , , | Leave a comment

Quick Tip #1: Implicit FIFOs in Bash

One could assume that I have run out of material and retreat to safer ground, but far from it. From now on I’ll just throw in a few quick shell hacks hoping some of you don’t know them yet. So, … Continue reading

Posted in shell | Tagged , , ,