Skip to content

Instantly share code, notes, and snippets.

@scoffey
scoffey / peg.py
Created Aug 13, 2018
Peg solitaire solver (using depth-first search)
View peg.py
#!/usr/bin/env python2.7
import sys
# Global constants
SIZE = 7
FINAL_BOARD = 1 << 24 # 1 << ((SIZE * SIZE - 1) / 2)
def solve(board):
explored = set()
@scoffey
scoffey / keybase.md
Last active Jan 28, 2017
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am scoffey on github.
  • I am scoffey (https://keybase.io/scoffey) on keybase.
  • I have a public key whose fingerprint is 07AD 476D D09D 192E 8B38 1BAD CB3E C9E4 FF13 0596

To claim this, I am signing this object:

@scoffey
scoffey / webtail.py
Created Jan 15, 2012
HTTP server that provides a web interface to run "tail" on a file, like the Unix command
View webtail.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
HTTP server that provides a web interface to run "tail" on a file,
like the Unix command.
This is a standalone script. No external dependencies required.
How to invoke:
@scoffey
scoffey / microformats.py
Created May 4, 2011
Python microformats parser that supports hCard, hCalendar, hResume and rel-tag and provides an extensible model for other microformats.
View microformats.py
# -*- coding: utf-8 -*-
#!/usr/bin/env python
"""
Model for microformat properties and parsers. A microformat parser can
parse an HTML element into a dictionary of properties, whose keys are
strings and whose values are strings or other dictionary of properties.
As an example, the main program of this script parses an hResume from
given URL.
@scoffey
scoffey / pytunes.py
Created Nov 25, 2010
Sorts a given iTunes playlist according to the least played tracks in each album
View pytunes.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script implements an algorithm for sorting a given iTunes playlist
according to the least played tracks in each album.
It aims to identify the tracks that were played the least and to show
how many times they should be played in order to reach the same playcount
as the most played track in the album they belong to.