{{ message }}

Instantly share code, notes, and snippets.

# Tom Andersontomwhoiscontrary

Created Feb 27, 2014
View gcd.py
 #! /usr/bin/env python """ Conceptual complexity: the incidental complexity of the code is low, because it directly realises the mathematical algorithm, whose intrinsic complexity is, for the non-mathematical layman, about a cup of tea's worth of scribbling on a notepad Time complexity: you know, i have no idea; it's probably related to the number of factors in the inputs, and the number of factors in common
Last active Aug 29, 2015
Script to interactively sort some options by repeated comparison
View isort.py
 #! /usr/bin/env python import sys import itertools def recording_in(d): def recording(f): def recording_f(*args): result = f(*args) d[args] = result
Created Mar 18, 2014
View gridvote.py
 #! /usr/bin/env python import sys labels = sys.argv[1:] rows = map(lambda strings: map(int, strings), map(str.split, map(str.rstrip, sys.stdin.readlines()))) def vote(row): assert len(row) == len(labels)
Created Mar 27, 2014
London Code Dojo - 7 languages in 7 weeks: Haskell day 2 - code by Tom A and a bunch of other people
View dollars.hs
 module Dollars where import Test.HUnit ----------------------------------------------------- -- parsing dollars ----------------------------------------------------- parseDigit '0' = 0 parseDigit '1' = 1
Created Apr 23, 2014
Fails to compile under javac 1.6.0_26
View Firmament.java
 package com.youdevise; import com.youdevise.Firmament.Air.Earth; import java.io.Serializable; public class Firmament { public static class Air implements Serializable { public static class Earth {} }
Created Jun 19, 2014
What i learned my last job
View valediction.rst
• That working with a group of smart and well-informed developers is really enjoyable, but not sufficient to reliably make high-quality software (i don't know why not).
• How modern system administration is done, and a little about how it ought to be done.
• That large-scale automated CI, with dozens and dozens of slaves testing every conceivable aspect of the software in a short space of time, is possible and awesome.
• That if one day you don't feel like doing a proper job of something, or perhaps even finishing it at all, you can just tell everyone you're "focusing on delivering the business value", and it's fine.
• That the financial industry really is run just as badly as you feared.
Last active Aug 29, 2015 — forked from varjmes/humansize.py
View humansize.py
 SUFFIXES = {1000: ['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], 1024: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']} def approximate_size(size, a_kilobyte_is_1024_bytes=True): """Convert a file size to human-readable form. Keyword arguments: size -- file size in bytes a_kilobyte_is_1024_bytes -- if True (default), use multiples of 1024, if False, use multiples of 1000
Created Jan 15, 2015
View spring.log