Skip to content

Instantly share code, notes, and snippets.

View gist:9420167
def issues
_ = issues
components.each { |c| _ << c.issues}
return _.uniq
end
@lewiseason
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 = 'noreply@example.com'
recipient = 'root@example.com'
subject = 'Checks Failed'
mailserver = 'localhost'
View keybase.md

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 Aug 29, 2015
Move Tags when Rewriting History
View apply-tags.pl
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 Aug 29, 2015
Google Chrome Repo
View 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 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
View chart.py
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 Aug 24, 2016
Configuring Voyage Linux with Ansible
View voyage_ssh.py
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 Aug 5, 2020
paper_trail & rgeo-activerecord integration
View PAPERTRAIL_RGEO.md

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.