Skip to content

Instantly share code, notes, and snippets.

Avatar

Florian Rathgeber kynan

View GitHub Profile
@kynan
kynan / keybase.md
Created Sep 13, 2019
Keybase proof
View keybase.md

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:

@kynan
kynan / pandas_validation_errors.ipynb
Last active May 18, 2020
Pandas documentation validation errors
View pandas_validation_errors.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kynan
kynan / getbbcpid
Created Jun 14, 2017
Extract PIDs from BBC iPlayer programme pages
View getbbcpid
#!/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 / cahn_hilliard.py
Created Oct 1, 2015
Cahn-HIlliard Firedrake code for DSI screen
View cahn_hilliard.py
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)
View akn_parser.py
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 / gol.py
Created Oct 15, 2012
Game of Life with rule 24 in Python
View gol.py
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,
@kynan
kynan / test-automata.spec.coffee
Created Oct 15, 2012
Game of Life with rule 24 in Coffee
View test-automata.spec.coffee
DEAD = 0
ALIVE = 1
evolve_cell = (left, middle, right) ->
register = left*4+middle*2+right
#console.log left, middle, right, register
switch register
when 4 then ALIVE # from [ALIVE,DEAD,DEAD]
when 3 then ALIVE # from [DEAD,ALIVE,ALIVE]
else
@kynan
kynan / pre-commit
Created Jun 23, 2012
OP2 git client hooks
View pre-commit
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
@kynan
kynan / shoot.sh
Created Jun 16, 2012
Take a screenshot and upload to imgur
View shoot.sh
#!/bin/bash
#
# By Sirupsen @ http://sirupsen.dk
# Original version: http://sirupsen.com/a-simple-imgur-bash-screenshot-utility
# Modifications by Florian Rathgeber @frathgeber (https://github.com/kynan)
#
# Description: Very simple script to make you
# select a region of your screen, which will be captured, and
# then uploaded. The URL will then be injected into your clipboard.
#
@kynan
kynan / irssi_log_merge.py
Created May 16, 2012
Irssi Log Merger is a small Python script that takes a set of Irssi irclogs/ directories and merges them chronologically into a single set of files.
View irssi_log_merge.py
#!/usr/bin/python
# .- coding: utf-8 -.
#
# irssi_log_merge.py.
# Written by Lasse Karstensen <lasse.karstensen@gmail.com>, 2008.
# Released under GPLv2.
#
# Newest version available on http://hyse.org/irssi-log-merge/ .
#
# Modified by Florian Rathgeber <florian.rathgeber@gmail.com>
You can’t perform that action at this time.