Skip to content

Instantly share code, notes, and snippets.

@chrisloy
Created April 24, 2014 16:49
Show Gist options
  • Save chrisloy/11261449 to your computer and use it in GitHub Desktop.
Save chrisloy/11261449 to your computer and use it in GitHub Desktop.
def slurp(filename):
return [line.strip() for line in open(filename)]
def green(s):
return '\033[92m' + s + '\033[0m'
def blue(s):
return '\033[94m' + s + '\033[0m'
def red(s):
return '\033[91m' + s + '\033[0m'
def yellow(s):
return '\033[93m' + s + '\033[0m'
def cyan(s):
return '\033[96m' + s + '\033[0m'
def magenta(s):
return '\033[95m' + s + '\033[0m'
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
def average(l):
return reduce(lambda x, y: x + y, l) / len(l)
if __name__ == "__main__":
print "Import me, don't run me!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment