More is better: the quintuple-neck guitar

I remember when I saw my first double-neck guitar, I was really impressed. That seemed like a huge thing to have hanging from your neck. They became really popular in the Led Zeppelin, Yes and The Who era. The idea is to have 2 guitars handy, like a 6-string and a 12-string, or a bass and a guitar, a fretted and a fretless bass, or 2 guitars in a different tuning. But obviously it’s also one of those macho “size-matters” things. The guitarist with the double-neck here is Jimmy Page from Led Zeppelin.


Probe average cpu utilisation (MRTG)

There are two main tools to keep track of your CPU usage: top and vmstat.


Estimate # of lines in a log file

Let’s say you need an (approximate) count of the number of lines in a huge file. The most obvious way of calculating this would be using wc, but this actually can be quite slow:

> time wc -l /var/log/squid/access.log
2812824 /var/log/squid/access.log
real    0m43.988s
# (counting is done at 64.000 lines/sec)

Calculate hit rate from a log file

You have a huge file that contains one line per request/transaction. Some lines are of one type (e.g. ‘HIT’), some of another (e.g. MISS). Let’s say you want to calculate the hit-rate, but as fast as possible.
We take a Squid log file of about 140MB. How long does it take to count how many lines it has?

$ time wc -l /var/log/squid/access.log
845212 /var/log/squid/access.log
real 0m6.523s

(about 21.4 MB/s or 130.000 lines/s)


Squid: list top X referers

If your Squid server logs the referers of its request (i.e.

  1. you’ve configured squid-cache with --enable-referer-log before compiling and
  2. you’ve included a referer_log /var/log/squid/referer.log in your squid.conf file),
    you can easily show top 50 of most popular referers with a simple Bourne shell:
    #!/bin/bash

Redhat versions: what am I running?

If you manage multiple RedHat servers, or if you just stumble on a Linux server, and you have no idea what kind of machine it is, nor what the version of the OS is, try the following commands:


Casablanca: here’s looking at you


Well there’s a reputation well earned: Casablanca is one of the best films I’ve seen recently. I know it’s been out for a while (it was released in 1942) but I only bought the DVD last weekend. Great cast (Bogart as cool as a three-star freezer), strong script (Bergman torn between the two loves of her life, and then some WWII thrown in), and superb dialogues.


Intelligence is the mind’s worst enemy


If you’re interested in high level conversations on a wide range of topics, check out edge.org. Their motto: To arrive at the edge of the world’s knowledge, seek out the most complex and sophisticated minds, put them in a room together, and have them ask each other the questions they are asking themselves.
There’s fascinating stuff about quantum computing and black swan dynamics, but a piece in the last publication jumped out, a discussion on ‘A self worth having’:


Google is listening: searching audio

There are rumours that Google would be rolling out search functionality for audio files. It is true that currently no sound files (.wav, .mp3, .wma, .mov, .ogg, …) files can be found by Google’s “normal search”, except for the odd mis-indexed mp3 file.
Multimedia search is a fascinating topic, let’s talk about audio for a moment:


Adobe authors Digital Negative (DNG) standard

Adobe has developed a new format for ‘raw’ camera files, called Digital Negative.
The DNG specifications (PDF) uses the following arguments for its existence: