#!/usr/bin/env python import os.path, re, glob print 'Content-Type: text/html; charset=utf-8' print print '' print 'Gallimaufry of Whits' print '' print '' print '

Gallimaufry of Whits

' print '

Written by Sean B. Palmer. Subscribe to Atom or @OfWhits' r_title = re.compile(r"(.*?)") files = sorted((os.path.getmtime(fn), fn) for fn in glob.glob("2012/*.html")) files = reversed(files) files = list(files)[:10] for (mtime, fn) in files: with open(fn) as f: bytes = f.read() content = bytes.split('\n\n', 1).pop() title = r_title.search(bytes).group(1) print '

%s

' % title print content