Skip to content

Instantly share code, notes, and snippets.

lewiseason /
Last active Aug 5, 2020
paper_trail & rgeo-activerecord integration

The default serializer will serialize the entire ruby object of your geospatial column. This custom serializer will serialize it to WKT (WKB isn't an option here without casting). This is much more efficient than serializing the entire ruby object, and much safer.

lewiseason /
Created Aug 24, 2016
Configuring Voyage Linux with Ansible
from __future__ import (absolute_import, division, print_function)
from functools import wraps
from ansible.plugins.connection import ConnectionBase
from ansible.plugins.connection.ssh import Connection as SSHConnection
def voyage_mount_ro(func):
def _inner(self, *args, **kwargs):
super(Connection, self).exec_command('[[ -x /usr/local/sbin/remountro ]] && /usr/local/sbin/remountro')
return func(self, *args, **kwargs)
lewiseason /
Created Aug 22, 2016
Hammer the official UK chart from a known starting point and write out a CSV of title, artist and highest position achieved
import csv
from lxml.html import parse
inf = float('inf')
base_uri = ''
start_page = '/charts/singles-chart/20150828/7501/'
positions = {}
def parse_page(page):
tree = parse(base_uri + page)
lewiseason / google-chrome.repo
Last active Aug 29, 2015
Google Chrome Repo
View google-chrome.repo
name=google-chrome - $basearch
lewiseason /
Last active Aug 29, 2015
Move Tags when Rewriting History
while (<>) {
($old, $tag, $message) = split("\0", $_);
# Escape double quotes
$message =~s/"/\\"/g;
@matches = split("\n", `git log --all --oneline --grep="^$message\$"`);
$count = @matches;
if ($count == 1){

Keybase proof

I hereby claim:

  • I am lewiseason on github.
  • I am lewiseason ( on keybase.
  • I have a public key whose fingerprint is 6890 A599 9D54 B325 5C17 BE2A 80D9 024D 7A1A 6AB6

To claim this, I am signing this object:

lewiseason / check
Created Jun 14, 2014
Check status of some web services and send an email if they're down
View check
#!/usr/bin/env python
# check - Check status of some web services
# and send an email if they're down.
# List of checks to perform. Tuples in the form
# (url, expected_http_response)
sender = ''
recipient = ''
subject = 'Checks Failed'
mailserver = 'localhost'
View gist:9420167
def issues
_ = issues
components.each { |c| _ << c.issues}
return _.uniq