Skip to content

Instantly share code, notes, and snippets.

def issues
_ = issues
components.each { |c| _ << c.issues}
return _.uniq
end
@lewiseason
lewiseason / check
Created June 14, 2014 17:49
Check status of some web services and send an email if they're down
#!/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 = 'noreply@example.com'
recipient = 'root@example.com'
subject = 'Checks Failed'
mailserver = 'localhost'

Keybase proof

I hereby claim:

  • I am lewiseason on github.
  • I am lewiseason (https://keybase.io/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
lewiseason / apply-tags.pl
Last active August 29, 2015 14:21
Move Tags when Rewriting History
while (<>) {
chomp($_);
($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){
@lewiseason
lewiseason / google-chrome.repo
Last active August 29, 2015 14:23
Google Chrome Repo
[google-chrome]
name=google-chrome - $basearch
baseurl=http://dl.google.com/linux/chrome/rpm/stable/$basearch
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
@lewiseason
lewiseason / chart.py
Created August 22, 2016 19:43
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 = 'http://www.officialcharts.com'
start_page = '/charts/singles-chart/20150828/7501/'
positions = {}
def parse_page(page):
tree = parse(base_uri + page)
@lewiseason
lewiseason / voyage_ssh.py
Created August 24, 2016 19:26
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):
@wraps(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
lewiseason / PAPERTRAIL_RGEO.md
Last active August 5, 2020 18:28
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.