Skip to content

Instantly share code, notes, and snippets.

View choffee's full-sized avatar

John Cooper choffee

View GitHub Profile
@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 / 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 / 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
#!/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 / 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
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
#!/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 / Onename verify
Created July 29, 2014 15:36
Onename verify
Verifying myself: My Bitcoin username is +choffee. https://onename.io/choffee
@choffee
choffee / Cheerlight-rainbowduino.ino
Created December 4, 2014 09:21
Simple code for rainbowduino to change colour in response to a serial command for cheerlights
/*
Rainbowduino v3.0 Library examples : Mood Lamp
*/
#include <Rainbowduino.h>
// HSV to RGB array generated using the following perl script
@choffee
choffee / Spark_core_mqtt.ino
Created February 1, 2015 22:33
Kitchen SparkCore to MQTT bridge
// This #include statement was automatically added by the Spark IDE.
#include "MQTT/MQTT.h"
// Define the pins we're going to call pinMode on
const int led_red = A5;
const int led_green = A4; // This one is the built-in tiny one to the right of the USB jack
const int led_blue = A6;
const int number_of_inputs = 4;
int inputs[] = { D1, D2, D3, D4};