Skip to content

Instantly share code, notes, and snippets.

@tef
Last active December 17, 2015 13:29
Show Gist options
  • Save tef/5617018 to your computer and use it in GitHub Desktop.
Save tef/5617018 to your computer and use it in GitHub Desktop.
python/ruby quine. changes comment to indicate what it last ran as.
# Python or Ruby
l,p,q=(""and"# Ruby"+10 .chr or"# Python"+chr(10)),'l,p,q=(""and"# Ruby"+10 .chr or"# Python"+chr(10))','print((""and"#{print l;c=39.chr;puts p+44.chr+c+p+c+44.chr+c+q+c;puts q}"or"{}{},{!r},{!r}{}{}".format(l,p,p,q,chr(10),q)))'
print((""and"#{print l;c=39.chr;puts p+44.chr+c+p+c+44.chr+c+q+c;puts q}"or"{}{},{!r},{!r}{}{}".format(l,p,p,q,chr(10),q)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment