I once wrote a Java version of the infamous unstash script, written in Perl.
As I am picking up Python (so refreshing, so little clutter) I thought it would be nice as a little practice to rewrite it in Python as well. And it is really compact.
This is what I came up with:
#!/usr/bin/python # (c) 2013 Jeroen Zomer http://strelitzia.net import sys def parseStash(): if len(sys.argv) < 2: print "please add the stashfile as argument" return print "extracting password from: " + sys.argv[1] for b in open(sys.argv[1]).read(): if ord(b) == 0xf5 : return sys.stdout.write( chr(ord(b) ^ 0xf5) ) parseStash()
or if we would take the absolute bare minimum, it gets really impressive how powerful and compact python can be:
import sys def parseStash(): for b in open(sys.argv[1]).read(): if ord(b) == 0xf5 : return sys.stdout.write( chr(ord(b) ^ 0xf5) ) parseStash()
This reminds me of the famous oneliners we used to have in Basic or the JavaScript 1k competitions…
Each and every bride wants to locate a costume type that improves her search for her wedding
reception. This amazing Russian bear not only does
these unbelievable things, but he seems to be enjoying himself, too.
For this reason, it is important for any would be learner to humble themselves and start
off with this simple trumpet, and then later on advance to the higher order trumpets as seen fit by their instructors.