Labels

Recent Posts

Tuesday, September 9, 2014

A GIF image can be run as Python, Ruby, JavaScript, and Jave program.

The above image, face6.gif, is a proper GIF can be run as python script in window/linux/mac/cygwin.
That is, try
python face6.gif
in command line, it can be executed (by CPython).
Moreover, it can run as ruby, perl, and java program.
ruby -x face6.gif
perl -x face6.gif 
java -jar face6.gif

If you rename face6.gif to face6.html and open it with a web browser, the  javascript  code with print "Python rocks".

You can also try
rar x face6.gif
and not suprising, you can use also open it with any image viewer.

Since it is a jar file, so using unzip -v face6.gif,  you can find java classes. It also contains a  __main__.py, but __main__.py won't be executed by CPython. This is because CPython does not like zip files with comment.

No comments:

Post a Comment