In the context of a program, an Easter egg is an undocumented response that results from a specific input. The classic example is the Konami code (up up down down left right left right B A), used as a cheat code in various video games. (The Konami code has been used in many other places you wouldn’t expect, including a lens flare effect that used to be an Easter egg on Facebook.) You can Google that, so do that if you haven’t already. Here, I want to list a few fun Easter eggs.
I started this by simply looking at Python, but then expanded the list to include some others. So, it’s still a bit heavier on Python with randomness coming afterwards.
Python has some good ones. My favorite is the one that is built in to the ‘__future__’ module. This module is intended for future Python additions, or things that are going to be in Python but aren’t there just yet. One thing that keeps getting asked for by some Python users is a C-style braces-wrapped scoping system, contrary to Python’s white-space scope delimiters. So, when ‘braces’ showed up in the ‘__future__’ module, some may have been excited … until they tried it out. Here’s what happens.
>>> from __future__ import braces File "<stdin>", line 1 SyntaxError: not a chance
This references an XKCD comic. It actually opens a browser and loads the XKCD comic when you run it.
>>> import antigravity
There’s a hello world Easter egg in Python.
>>> import __hello__ Hello world!
The Zen of Python
This is probably, at this point, the most well-known Python Easter egg. “The Zen of Python,” now officially PEP-20, was originally sent by Tim Peters (now functioning as “occasional contributor of great knowledge” to Python) to the python-list back in 1999 in this post. In 2001 while organizing IPC10 (the precursor to PyCon), Barry Warsaw and Tim filtered through a massive list of crowd-sourced potential slogans for an IPC t-shirt and came up with “import this”. The combination of “The Zen of Python” and “import this” was merged secretly in Python 2.2.1, and if you ‘cat’ the contents of this.py (e.g., in /usr/lib/python2.x) you’ll see that there is some encryption so the message isn’t immediately obvious in a commit. Anyway, it does the following when called.
>>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!
Firefox / Iceweasel
If you’re using Firefox (or its Debian brother with properly licensed logo… Iceweasel), then you can try looking at the following.
Gort! Klaatu barada nikto!
About:robots is a nice page: Gort! Klaatu barada nikto!.
The Book of Mozilla
About:mozilla is oddly Biblical and has been changing in new versions along with Mozilla development since early 90s Netscape. It’s just really weird. The current version, as I write this, reads: “The twins of Mammon quarrelled. Their warring plunged the world into a new darkness, and the beast abhorred the darkness. So it began to move swiftly, and grew more powerful, and went forth and multiplied. And the beasts brought fire and light to the darkness.” The Book of Mozilla.
Go to any video on YouTube (it has to be on youtube; not embedded from youtube onto another site). Start playing a video (beyond the ads) and pause the video. With the video paused, hold down the left arrow button on your keyboard and (while holding it down) press the up button.
The menorah has long been the logo for CLISP. This page explains why. When you run CLISP, you get the menorah, as in the following.
$ clisp i i i i i i i ooooo o ooooooo ooooo ooooo I I I I I I I 8 8 8 8 8 o 8 8 I \ `+' / I 8 8 8 8 8 8 \ `-+-' / 8 8 8 ooooo 8oooo `-__|__-' 8 8 8 8 8 | 8 o 8 8 o 8 8 ------+------ ooooo 8oooooo ooo8ooo ooooo 8 Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/> Copyright (c) Bruno Haible, Michael Stoll 1992, 1993 Copyright (c) Bruno Haible, Marcus Daniels 1994-1997 Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998 Copyright (c) Bruno Haible, Sam Steingold 1999-2000 Copyright (c) Sam Steingold, Bruno Haible 2001-2010 Type :h and hit Enter for context help. >
What many CLISP users haven’t noticed is that the candles on the menorah are lit properly during Hanukkah.
Help with the meaning of life…
In Vim, if you issue the command ‘:help 42′ you get the following output.
What is the meaning of life, the universe and everything? *42* Douglas Adams, the only person who knew what this question really was about is now dead, unfortunately. So now you might wonder what the meaning of death is... ============================================================================== Next chapter: |usr_43.txt| Using filetypes Copyright: see |manual-copyright| vim:tw=78:ts=8:ft=help:norl:
Apt-get and Aptitude
The apt package management system (used by Debian-based Linux systems) has several Easter eggs, mostly related to cows.
Cow Powers of Apt and Aptitude
If you ask apt for help documentation, the last line that it returns is a bit weird.
$ apt-get help apt 0.9.7.9 for amd64 compiled on Nov 16 2013 12:41:41 Usage: apt-get [options] command apt-get [options] install|remove pkg1 [pkg2 ...] ... ... ... -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp See the apt-get(8), sources.list(5) and apt.conf(5) manual pages for more information and options. This APT has Super Cow Powers.
So, we know that apt does have super cow powers. What does that mean? Well, it should probably be able to moo.
$ apt-get moo (__) (oo) /------\/ / | || * /\---/\ ~~ ~~ ...."Have you mooed today?"...
So, that works. What about aptitude? Since aptitude is supposed to be an improved apt interface, we’d expect something more. But, when we ask aptitude for its help string, we get the following.
$ aptitude help aptitude 0.6.8.2 Usage: aptitude [-S fname] [-u|-i] aptitude [options] <action> ... Actions (if none is specified, aptitude will enter interactive mode): ... ... ... (terminal interface only) -i Perform an install run on startup. (terminal interface only) This aptitude does not have Super Cow Powers.
Hmmm… so aptitude claims to not have super cow powers. What happens if we ask it to moo?
$ aptitude moo There are no Easter Eggs in this program.
OK. Maybe we just need to ask correctly…
$ sudo aptitude moo [sudo] password for jason: There are no Easter Eggs in this program. $ aptitude -v moo There really are no Easter Eggs in this program.
Now, most people would just stop here. But, a real Easter egg isn’t found by stopping. What if we keep asking for more verbosity?
$ aptitude -vv moo Didn't I already tell you that there are no Easter Eggs in this program? $ aptitude -vvv moo Stop it! $ aptitude -vvvv moo Okay, okay, if I give you an Easter Egg, will you go away? $ aptitude -vvvvv moo All right, you win. /----\ -------/ \ / \ / | -----------------/ --------\ ---------------------------------------------- $ aptitude -vvvvvv moo What is it? It's an elephant being eaten by a snake, of course. $ aptitude -vvvvvvv moo What is it? It's an elephant being eaten by a snake, of course.
That’s a good Easter egg.
sl instead of ls
For those that misspell commands in a hurry
Some Linux distros have a command named ‘sl’ which is designed to mock those that misspell ‘ls’ at the command-line. (E.g., in Ubuntu/Mint/Debian you can use ‘sudo apt-get install sl’.) This command simply chugs a train across the screen, forcing you to wait and watch the train before you can attempt to enter ‘ls’ again.
Release note recipes
If you have an old SGI machine running Irix, type the following.
> relnotes dmedia_eoe 29
What should give you release notes … actually gives you a kung pao chicken recipe.