Skip to content

Instantly share code, notes, and snippets.

View dtuominen's full-sized avatar

Dylan Tuominen dtuominen

  • Minneapolis, MN
View GitHub Profile
@dtuominen
dtuominen / brew install glib log
Created August 13, 2012 13:37
Updated to Mountain Lion, brew will not install glib, also having permissions issues.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by glib configure 2.32.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --disable-maintainer-mode --disable-dependency-tracking --disable-dtrace --prefix=/usr/local/Cellar/glib/2.32.4 --localstatedir=/usr/local/var
## --------- ##
## Platform. ##
@dtuominen
dtuominen / markov.py
Created October 15, 2012 15:48
markov.py
#!/usr/bin/env python
"""markov generator to make u feel bad
Usage:
markov.py [<length>] [--sms=<number>]
Options:
--help -h show this menu
-s NUMBER, --sms=<number> end an sms to a number
"""
import random
from collections import defaultdict
def get_words(fname='fyad.txt'):
with open(fname) as f:
return f.read().split()
def triplets(words):
for i in xrange(len(words) - 2):
yield (words[i], words[i+1], words[i+2])
import random
from pprint import pprint
from collections import defaultdict
def get_words(fname='fyad.txt'):
with open(fname) as f:
return f.read().split()
def triplets(words):
for i in xrange(len(words) - 2):
#!/usr/bin/env python
import random
from pprint import pprint
from collections import defaultdict
def get_words(fname='fyad.txt'):
with open(fname) as f:
return f.read().split()
def triplets(words):
#!/usr/bin/env python
import random
from pprint import pprint
from collections import defaultdict
def get_words(fname='fyad.txt'):
with open(fname) as f:
return f.read().strip().split()
def triplets(words):
#!/usr/bin/env python
from string import lowercase
from collections import defaultdict
from pprint import pprint
def coded_vals():
for i, l in enumerate(lowercase):
yield l, i+1
#!/usr/bin/env python
from string import lowercase
from collections import defaultdict
def coded_vals():
for i, l in enumerate(lowercase):
yield l, i+1
def make_map(code_map):
#!/usr/bin/env python
from collections import defaultdict
import random
w, h, m = 15, 15, 20
def coords(x, y):
for i in xrange(h+1):
for n in xrange(w+1):
yield(i, n)
#!/usr/bin/env python
from collections import defaultdict
import random
w, h, m = 15, 15, 20
coords = lambda x,y: [(i, n) for i in xrange(h) for n in xrange(w)]
mine = lambda m: [random.choice([c for c in coords(h,w)]) for i in xrange(m)]
def create_board(w, h, m):