Skip to content

Instantly share code, notes, and snippets.

View choffee's full-sized avatar

John Cooper choffee

View GitHub Profile
#!/usr/bin/env python
import time
from time import sleep
import Adafruit_Nokia_LCD as LCD
import Adafruit_GPIO.SPI as SPI
import Adafruit_BBIO.GPIO as GPIO
import Image
@choffee
choffee / river_levels_uk_scrpaer.py
Created September 26, 2013 18:39
Scraper for the UK river levels.
#!/usr/bin/env python
import scraperwiki
import requests
import lxml.html
import sys
from datetime import datetime
base_url='http://www.environment-agency.gov.uk'
#!/usr/bin/env python
# Script to upload the human calendar to an lcdstatus screen
# Requires the python lcdstatus screen library at:
# https://github.com/dangardner/pylcdsysinfo
# Written by John Cooper 2013
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@choffee
choffee / nfsio-collectd.patch
Last active December 11, 2015 04:58
Another patch to nfsiostat. This time so that it can be run from collectd. Add the following to your collectd.conf to make it happen. LoadPlugin Exec <Plugin exec> Exec "nobody" "/usr/local/bin/nfsiostat.collectd" "20" "/nfs/mountpoint" </Plugin>
--- /usr/sbin/nfsiostat 2012-04-09 13:21:11.000000000 +0100
+++ nfsiostat.collectd 2013-01-16 16:23:24.020173069 +0000
@@ -22,6 +22,8 @@
"""
import sys, os, time
+import socket
+from datetime import datetime
from optparse import OptionParser, OptionGroup
@choffee
choffee / nfsiostat_graphite.diff
Created January 3, 2013 16:39
A simple patch to the nfsiostat command in debian that will output stats that you can send directly to graphite. # nfsiostat 30 |netcat graphiteserver.example.com 2003
--- /usr/sbin/nfsiostat 2012-04-09 13:21:11.000000000 +0100
+++ nfsiostat 2013-01-03 16:28:11.564087330 +0000
@@ -22,6 +22,8 @@
"""
import sys, os, time
+import socket
+from datetime import datetime
from optparse import OptionParser, OptionGroup
@choffee
choffee / puppet.vim
Created April 26, 2012 08:16
Add support for puppet define to git. Just save it as puppet.vim in ~/.vim/ftplugin/
" Takes some settings
" g:puppet_command The location of the puppet command
if !exists('g:puppet_command')
let g:puppet_command = 'puppet'
endif
" g:puppet_doc_widown - The type of puppet doc window to open
if !exists('g:puppet_doc_window')
let g:puppet_doc_window = 'split'
endif
@choffee
choffee / footprints_noQuickEdit.user.js
Created February 22, 2012 13:39
Footprints replace quickEdit with the more useful Details
// ==UserScript==
// @name Footprints details
// @namespace http://userscripts.org/users/58394
// @description Changes the details from
// @include https://footprints.york.ac.uk/*
// ==/UserScript==
//
//
window.addEventListener("load", function(e) {
@choffee
choffee / calendar_date.user.js
Created June 15, 2009 12:05
Script to highlight day of month for sun calendar
// ==UserScript==
// @name Calender date
// @namespace http://choffee.co.uk/code/
// @include https://calendar.york.ac.uk/command.shtml?view=monthview:main*
// ==/UserScript==
//
// This is neither pretty or clever but it does fix a really annoying bit in sun calendar
// for me. It highlights the current day.
// Note: It should also check that you are looking at the correct month!
//
//Note: This command was automatically generated by the create-new-search-command command.
CmdUtils.makeSearchCommand({
name: "oed-search",
url: "http://dictionary.oed.com/cgi/findword?query_type=word&queryword={QUERY}",
icon: "http://dictionary.oed.com/favicon.ico",
description: "Searches dictionary.oed.com"
});
@choffee
choffee / x
Created February 26, 2009 12:43
//Note: This command was automatically generated by the create-new-search-command command.
CmdUtils.makeSearchCommand({
name: "ubuntu-bug-search",
url: "https://bugs.launchpad.net/+bugs?field.searchtext={QUERY}&field.status%3Alist=NEW&field.status%3Alist=INCOMPLETE_WITH_RESPONSE&field.status%3Alist=INCOMPLETE_WITHOUT_RESPONSE&field.status%3Alist=CONFIRMED&field.status%3Alist=TRIAGED&field.status%3Alist=INPROGRESS&field.status%3Alist=FIXCOMMITTED&field.assignee=&field.bug_reporter=&field.omit_dupes=on&field.has_patch=&field.has_no_package=",
icon: "http://bugs.launchpad.net/favicon.ico",
description: "Searches bugs.launchpad.net"
});