Slashdot Easter Egg
Did you know that every time you view a page on slashdot, you’re given a random Futurama quote? Most people don’t, since they’re hidden away in the HTTP headers, so you’ll never see them via normal web browsing. I discovered this one time when I was playing around with cURL. Here’s a sample HTTP trace:
adam-rosenfields-computer ~$ curl -I slashdot.org HTTP/1.1 200 OK Date: Sat, 11 Oct 2008 04:16:23 GMT Server: Apache/1.3.41 (Unix) mod_perl/1.31-rc4 SLASH_LOG_DATA: shtml X-Powered-By: Slash 2.005001224 X-Bender: Boy, were we suckers! Cache-Control: private Pragma: private Connection: close Content-Type: text/html; charset=iso-8859-1
-I
is the option for doing a HEAD request instead of a normal GET. So, a quick and dirty script to generate a random Futurama quote is:
curl -I slashdot.org 2>/dev/null | grep '^X-' | grep -v '^X-Powered-By'
This works since all of the quotes are under a header name beginning with X-
, e.g. X-Bender
, X-Fry
, or X-Leela
. I’m not sure how many total quotes there are in the database, but you could probably get a good estimate by sampling a large number of times and counting how many unique quotes and how many duplicates you get, and then extrapolating.