Saturday, March 22, 2008

Futurama fans: Listen up

There's a nifty unix command you can enter to get random futurama quotes:
curl -Is | egrep '^X-(F|B)' | cut -d \- -f 2

Okay, so how does it work? Let's look at what curl -Is returns:

HTTP/1.1 200 OK
Date: Sun, 23 Mar 2008 01:04:28 GMT
Server: Apache/1.3.37 (Unix) mod_perl/1.29
X-Powered-By: Slash 2.005000198
X-Leela: I'm a millionaire! Suddenly I have an opinion about the capital gains tax.
Cache-Control: private
Pragma: private
Vary: User-Agent,Accept-Encoding
Connection: close
Content-Type: text/html; charset=iso-8859-1

Pretty neat eh?
Now, what it does is it looks for lines that start with "X-" and contain F or B after the "X-"; thus bringing up Fry or Bender quotes only :).


Vitaliy said...

It is much easier to use a classic UNIX app called fortune. It displays random quotes from a database, there are quote databases ranging everything from Futurama to Kernel mailing list quotes!

Robert O'Connor said...

I am fully 100% aware of that; I just found it neat is all.