Idea: using a URI for sending email

In order to send an email over SMTP, you need 2 sets of information:

IT Conversations: podcasting feeds your brain

There’s only one way to check if podcasting can change your life, and that is by diving completely into it. Since last week, I am the proud owner of a 20GB iPod, (the first Apple product I have ever bought) and it is hard not to be enthusiastic about it. It might not be the cheapest hard-disk MP3 player around, but it is by far the most funky. Especially the user interface was very intuitive, which is important for the ain’t-gonna-RTFM person that I am.

Squid cachemgr.cgi UI hack

Squid has a little system statistics viewer built-in:

Date formatting in GAWK: boot time

I have one server with apparently an exceptional stability:

It’s the latency, stupid!

While working on some bandwidth-related stuff (my bandwidth calculator), I came across an excellent article on “latency vs. bandwidth” by Stuart Cheshire. It was originally written in 1996, so focuses a lot on modems, but Fact 1, 2 and 4 are still valid.

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: