Skip to content

Instantly share code, notes, and snippets.

View tef's full-sized avatar
💭
Please don't try to contact me over GitHub.

tef tef

💭
Please don't try to contact me over GitHub.
View GitHub Profile
⢠⠃
⡠⠋⠉⠁
⠱⣀⣀⡰⠉⠉⠱⡀
⡤⠤⡄ ⡜
⢎ ⢈⠆ ⠈⠦⠤⢄
⢈⠆ ⢎ ⢀⠖⠒⢆ ⢈⠆
⢠⠒⠒⠃ ⠓⠒⠃ ⠓⠒⠃
⠣⡀ ⡠⠋⠉⠣⡀
⣀⣀⡀⠉⠉⠱⡀ ⠱⡀ ⡰⠁
⢀⣠⡶⣦⣄
⣀⡤⣤⣸⡷ ⢾⣀⣤⣤⣀
⢸⡯⠁⠉⠉ ⠈⠉⠁⠈⣽
⣀⡀ ⠘⠓⣦ ⢀⡶⠚ ⢀⣀
⢰⡓⠋⠓⣳ ⢰⡞⠋ ⠛⣳ ⣞⠛⠙⣳⡆
⢠⡶⠏⠷⠾⠁ ⠹⠶⠏⠷⠾⠋ ⠹⠶⠟⠻⠶⠏ ⠙⠷⠿⠹⢶⡄
⢸⣃⡀ ⢀⣹⡇
⢀⣄⡿ ⢿⣄⡀
⢸⠆ ⢼⡇
⠈⠛⠷⠟⢻⡆ ⣼⡟⠻⠾⠛⠁
import sys
output = []
for line in sys.stdin.readlines():
line = line.split()
for n in range(len(line)):
output.append(" ".join(line[n:]+line[:n]))
for line in sorted(output):
print line
(build_env)lin-kernighan:ToolBelt tef$ pip wheel ToolBelt
ERROR: 'pip wheel' requires the 'wheel' package. To fix this, run: pip install wheel
(build_env)lin-kernighan:ToolBelt tef$ pip wheel -b
Usage:
pip wheel [options] <requirement specifier> ...
pip wheel [options] -r <requirements file> ...
pip wheel [options] <vcs project url> ...
pip wheel [options] <local project path> ...
pip wheel [options] <archive url/path> ...
$ zip app.zip __main__.py
adding: __main__.py (deflated 76%)
$ echo '#!/usr/local/bin/python3' > app
$ cat app.zip >> app
$ chmod +x app
$ ./app
usage: ./app <filter> <filter> <filter>
@tef
tef / dont_do_this.md
Created April 11, 2014 07:26
Please don't do this

Pleae don't do this

Hello is this tef?

Yes. Who is this?

David

Who?

______
< what >
------
\
\
^__^
_______/(oo)
/\/( /(__)
| W----|| |~|
|| || |~| ~~
# based upon http://www.johndcook.com/standard%5Fdeviation.html
from collections import OrderedDict
class RunningStat(object):
def __init__(self):
self.n = 0
self.m = None
self.s = None
self.min = None
self.max = None
possible assignments:
- add tests to check the behaviour is correct.
don't compare it to python's output, just check that each element is greater than the
next, with the compare function
- add profiling code, and run it with much, much larger lists ~5000 elements
which one is fast, slow?
- quick sort picks a random pivot, is this a good choice? what happens on larger lists
class ShittyHashTable:
def __init__(self, buckets = 8):
self.buckets = []
for x in range(8):
self.buckets.append([])
def add(self, key, value):
n = shittyhash(key, len(self.buckets))
bucket = self.buckets[n]
for i, pair in enumerate(bucket):