Pleae don't do this
Hello is this tef?
Yes. Who is this?
David
Who?
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): |
| #!/usr/bin/env python3 | |
| import random | |
| def msort(array, compare): | |
| l = len(array) | |
| if l > 2: | |
| mid = l//2 | |
| left = msort(array[:mid], compare) | |
| right = msort(array[mid:], compare) | |
| return merge(left, right, compare) |
| % Install these fonts http://ipafont.ipa.go.jp/#en | |
| \documentclass[12pt]{article} | |
| \usepackage{fontspec, xunicode, xeCJK} | |
| \setCJKmainfont{IPAexMincho} | |
| \setCJKsansfont{IPAexGothic} | |
| \setCJKmonofont{IPAexGothic} | |
| \begin{document} | |
| Hello World, or こんにちは 世界! | |
| \end{document} |
| $ cat > quine.php | |
| Hello, World! | |
| $ php quine.php | |
| Hello, World! | |
| $ |
| from sys import stdin, stdout | |
| import argparse | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('-r', action='store_const', const=True, required=False, default=False) | |
| args = parser.parse_args() | |
| stdout.writelines(sorted(stdin.readlines(), reverse = args.r)) |
| \documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{$documentclass$} | |
| \usepackage[T1]{fontenc} | |
| \usepackage{lmodern} | |
| \usepackage{amssymb,amsmath} | |
| \usepackage{ifxetex,ifluatex} | |
| \usepackage{fixltx2e} % provides \textsubscript | |
| % use upquote if available, for straight quotes in verbatim environments | |
| \IfFileExists{upquote.sty}{\usepackage{upquote}}{} | |
| \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex | |
| \usepackage[utf8]{inputenc} |