Skip to content

Instantly share code, notes, and snippets.

View kevinslin's full-sized avatar

Kevin Lin kevinslin

View GitHub Profile
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
import random
def compare_with_ties(a, b):
diff = cmp(a, b)
return diff if diff else random.choice([-1, 1])
a = {'a': 1, 'b': 2, 'c': 1, 'd':2, 'e': 1}
print "Initial dictionary:\n", str(a.iteritems())
import random
def compare_with_ties(a, b):
diff = cmp(a, b)
return diff if diff else random.choice([-1, 1])
a = {'a': 1, 'b': 2, 'c': 1, 'd':2, 'e': 1}
print "Initial dictionary:\n", str(a.iteritems())