Include a Shot of Jaq Easter Egg in your Next Application

I claim this stunt in the name of balpha!

The application in question is Unicornify. Since it's a web app, everyone can see the egg for themselves. Since Aq was pretty quick to find the easter egg, here is the description.

Unicornify is a little fun project of mine that works very much like Gravatar's identicons or monsterids. Given an MD5 hash, usually of an email address, it creates a random picture of a unicorn. Although it's random, it will always be the same one each time the same hash is passed.

So here's the easter egg: When you pass the hash b29b9f53a6358fae8f59237c182a45fb, which happens to be the MD5 hash of the SOJ feedback email address, you will not, as in any other case, have a picture of one unicorn, but two. And those are the unicorns created from the hashes of Jono's and Aq's addresses. Here's a high-quality version of the picture -- which you can't get through the web service, but I can :)

Jono and Aq as unicorns

And here are some relevant code snippets:

   1 # <snip> imports etc
   2 
   3 # In the actual code, it's the real addresses that get hashed
   4 jaq_hash = md5('talktous at shotofjaq dot org').hexdigest()
   5 jono_hash = md5('jono at jonobacon dot org').hexdigest()
   6 aq_hash = md5('sil at kryogenix dot org').hexdigest()
   7 bg_hash = md5('Community, community, community!').hexdigest()
   8 
   9 def create_jaq(size, with_background = True):
  10 
  11     jono_randomizer = Random()
  12     jono_randomizer.seed(int(jono_hash, 16))
  13     aq_randomizer = Random()
  14     aq_randomizer.seed(int(aq_hash, 16))
  15     bg_randomizer = Random()
  16     bg_randomizer.seed(int(bg_hash, 16))
  17 
  18     jono_data = UnicornData()
  19     aq_data = UnicornData()
  20     background_data = BackgroundData()
  21 
  22     # <snip> all the randomizing
  23 
  24     jono = Unicorn(jono_data)
  25     aq = Unicorn(aq_data)
  26 
  27     if with_background:
  28         im = get_background(size, background_data)
  29     else:
  30         im = SquareImage.plain(size * 2, (255, 255, 255))
  31 
  32     for n, unicorn in enumerate((jono, aq)):
  33 
  34         # <snip> some calculations
  35 
  36         unicorn.draw(im, wv)
  37 
  38     # <snip> final image operations
  39 

Comments on this page

You can comment on this page by posting a message to Twitter or Identi.ca with the hashtag #soj_u.