Skip to content

Instantly share code, notes, and snippets.

View alaroldai's full-sized avatar

Alastair Daivis alaroldai

View GitHub Profile
@alaroldai
alaroldai / hpphil.srt
Last active April 14, 2023 18:23
Subtitles for Harry Potter and the Philosopher's Stone, with some substitutions
1
00:01:22,064 --> 00:01:27,070
I should've known that you would
be here, Professor McGonagall.
2
00:01:38,290 --> 00:01:41,460
Good evening, Professor Dumbledore.
3
@alaroldai
alaroldai / columns.py
Created April 22, 2014 03:12
Format input files into columns, split by whitespace
#!/usr/bin/env python3
import sys, argparse
def columnize(fname, ncols):
f = open(fname, 'r')
lines = list(map(lambda l: l.split(), f.readlines()))
col = 0
cols = zip(*lines)
cols = list(map(lambda c: max((len(w) for w in c)), cols))[:ncols]