Songs in Code

I’m a bit late on commenting on this Twitter meme as it’s over a month old, like all memes it’s a variation of something as old as the Earth and just recently revived. The concept is simple, just write a song lyric or title as a code snippet, set it as your status and share with others by linking the #songsincode hashtag. That’s all.

Someone’s even made a database of all the posts where you can vote on the entries. Most are boring and just consist of lyrics padded out by punctuation, but there are some quite creative, non-obvious ones which use programming constructs to infer the lyrics. Here’s mine

class BillieJean : public girl
{ 
  int i; 
  relationship lover;
public: 
  BillieJean(relationship &me) 
  : lover(!me), i(1) {} 
};
body() { 
  print '<body>' . body() . '</body>'; 
} 
love() { 
  body();
}
/* mon = 255; tue=wed=0xaaaaaa; */ 
if (friday)
  love.insert(me);
GET /back.html HTTP/1.1
 
HTTP/1.1 301
Location: /you_once_belonged.html

Some of my favourites (with slight edits):

video$ kill -9 `ps -ef | grep radio*`

by bozrow

int main() {
  return -1;
  get_Satisfaction();
}

by stevecooperorg

$live = ($you==true) ? false : false;

by o_Freud_o

$i = '<HTML><HEAD></HEAD></HTML>';

by whybird

class City : Rock, Roll {};

by alexmdac

try {
  get(WHAT_YOU_WANT);
} finally {
  get(WHAT_YOU_NEED);
}

by rickgrundy

/dev/null << shout();

by plikrg