- make a bacon sandwich. why not put a bit of soy and cumin in the pan.
- use the bacon fat to fry some onions for like 40 minutes
- in the meantime, go and chop up some spring onions, cherry tomatoes and leaf salad. put in a bowl with a pinch of fresh coriander and a squirt of lime juice
- still in the meantime, go and chop up some garlic (like a bulb), some chilli
- take some beef mince, some diced chorizo and whip it up with some paprika, coriander, soy, tamari, gochujang, pepper, cayenne pepper, worchestershire sauce, maybe a hint of chipolte, and a whizz of lime juice. oh and i used ginger
- chuck chilli and garlic in the pan after the onions have gotten impatient (around 30-40-50 minutes)
- wait a little longer, about 10 minutes, and mash the meat into the pan and fry
- make some gnocchi.
- now everything smells tasty, and the meat is browned and cooked, chuck in some (whatever) beans from a tin.
- take the cooked gnocchi and chop it a little and stick it in the pan too. ooh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. pandoc -D latex > pandoc.template.jp.tex | |
2. following instructions from https://groups.google.com/d/msg/pandoc-discuss/R8T4j7SrJXk/EXNLBcm28z0J | |
go into the .tex file and change the XeTeX part so it reads: | |
\ifxetex | |
\usepackage{fontspec,xltxtra,xunicode,xeCJK} | |
\setCJKmainfont{Kochi Mincho} | |
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat > quine.php | |
Hello, World! | |
$ php quine.php | |
Hello, World! | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |