Skip to content

Instantly share code, notes, and snippets.

View kynan's full-sized avatar
💭
I may be slow to respond and only triage notifications irregularly

Florian Rathgeber kynan

💭
I may be slow to respond and only triage notifications irregularly
View GitHub Profile
@kynan
kynan / gol.py
Created October 15, 2012 20:57
Game of Life with rule 24 in Python
from copy import copy
class GameOfLife:
RULES = {
(1,1,1): 0,
(1,1,0): 0,
(1,0,1): 0,
(1,0,0): 1,
(0,1,1): 1,
(0,1,0): 0,
from lxml import etree
ns = 'http://docs.oasis-open.org/legaldocml/ns/akn/3.0/CSD11'
ukm = 'http://www.legislation.gov.uk/namespaces/metadata'
hPath = etree.XPath('.//a:heading//text()', namespaces={'a': ns})
iPath = etree.XPath('.//a:intro//text()', namespaces={'a': ns})
cPath = etree.XPath('.//a:content//text()|.//a:content//a:ref/text()',
namespaces={'a': ns})
mdPath = etree.XPath('//ukm:PrimaryMetadata[1]', namespaces={'ukm': ukm})
yPath = etree.XPath('./ukm:Year/@Value', namespaces={'ukm': ukm})
@kynan
kynan / cahn_hilliard.py
Created October 1, 2015 20:11
Cahn-HIlliard Firedrake code for DSI screen
from firedrake import *
mesh = UnitSquareMesh(100, 100)
V = FunctionSpace(mesh, "CG", 1)
W = V*V
gamma = Constant(0.005)
D = Constant(10)
q, v = TestFunctions(W)
u = Function(W)
u0 = Function(W)
@kynan
kynan / getbbcpid
Created June 14, 2017 22:22
Extract PIDs from BBC iPlayer programme pages
#!/usr/bin/env python
"""Extract pids from a BBC iPlayer programme page.
usage: get_iplayer --pid $(getbbcpid <url>)
"""
from __future__ import print_function
from bs4 import BeautifulSoup
@kynan
kynan / pandas_validation_errors.ipynb
Last active May 18, 2020 22:16
Pandas documentation validation errors
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kynan
kynan / keybase.md
Created September 13, 2019 22:25
Keybase proof

Keybase proof

I hereby claim:

  • I am kynan on github.
  • I am frathgeber (https://keybase.io/frathgeber) on keybase.
  • I have a public key ASB5SYm7rBgwnwovMxDQDbfGg_al7HvhEknK4XuCHpb9two

To claim this, I am signing this object: