Skip to content

Instantly share code, notes, and snippets.

View avinashv's full-sized avatar

Avinash Vora avinashv

View GitHub Profile
@avinashv
avinashv / rpn_calculator.py
Created October 10, 2010 11:52
A reverse-polish notation calculator in Python
# a simple reverse-polish notation calculator
#
# shouldn't be too hard to extend this--variables seem like a natural progression
import operator
def error_string(token, values):
plural = ''
if values > 1:
plural = 's'
@avinashv
avinashv / US Cyber Command Code Text
Created July 8, 2010 03:41
US Cyber Command Code Decrypted
USCYBERCOM plans, coordinates, integrates, synchronizes and conducts activities to: direct the operations and defense of specified Department of Defense information networks and; prepare to, and when directed, conduct full spectrum military cyberspace operations in order to enable actions in all domains, ensure US/Allied freedom of action in cyberspace and deny the same to our adversaries.
From the md5 hash: 9ec4c12949a4f31474f299058ce2b22a
As detailed on: http://www.wired.com/dangerroom/2010/07/solve-the-mystery-code-in-cyber-commands-logo/
Reverse lookup from: http://www.md5decrypter.com/
@avinashv
avinashv / ghost.py
Created April 23, 2010 10:00
An implementation of the word game Ghost in Python
# ghost
# see more at http://en.wikipedia.org/wiki/Ghost_(game)
import random
minimum_length = 5
# create a list of the supplied word list
wordlist = '/usr/share/dict/words'
words = [word.rstrip().lower() for word in file(wordlist, 'r') if len(word.rstrip()) >= minimum_length]
@avinashv
avinashv / anagram.py
Last active March 18, 2021 21:09
A command-line anagram solver using the Linux/OS X wordlist.
def anagram_solve(letters, words):
solution = [word.lower() for word in words if len(word) == len(letters)]
for letter in letters:
solution = [word for word in solution if letter in word and letters.count(letter) == word.count(letter)]
return solution
if __name__ == "__main__":
import sys