Skip to content

Instantly share code, notes, and snippets.

@rjp
rjp / TSAQuestions.md
Created November 26, 2012 05:48
Questions for @SaveLewishamAE to ask @OfficeTSA at meetings

(Hopefully at least one of these questions is useful.)

Figures and stuff taken from my 2012-11-21 notes at the Greenwich TSA meeting. Might be flawed. Please double-check before quoting!

Also please fork, expand, notate, go wild.

Maternity

  1. What's the geographical distribution of the 5000 expected births? How would that distribute to the remaining 4 units?
  2. How much of the £17M saving would be needed to bring the other 4 units up to capacity for handling the extra births?
#!/usr/bin/env ruby
## disconnect
# ./disconnect.rb -u yourusername [-o /your/path] [-p yourhttpproxyserver]
#
# This is a command-line utility for the bulk-downloading of run data from
# the connect.garmin.com web application, which has lackluster export
# capabilities.
#
#!/usr/bin/env ruby -wKU
# Paste this code into a TextExpander snippet to have the Shakespeare Insult Kit a keystroke away
# Just set the Content of the TextExpander snippet to 'Shell Script', and give it an abbreviation
# Shakespeare Insult Kit: http://www.pangloss.com/seidel/shake_rule.html
print "Thou " + ["artless","bawdy","beslubbering","bootless","churlish","cockered","clouted","craven","currish","dankish","dissembling","droning","errant","fawning","fobbing","froward","frothy","gleeking","goatish","gorbellied","impertinent","infectious","jarring","loggerheaded","lumpish","mammering","mangled","mewling","paunchy","pribbling","puking","puny","qualling","rank","reeky","roguish","ruttish","saucy","spleeny","spongy","surly","tottering","unmuzzled","vain","venomed","villainous","warped","wayward","weedy","yeasty","cullionly","fusty","caluminous","wimpled","burly-boned","misbegotten","odiferous","poisonous","fishified","Wart-necked"].shuffle.first + " " + ["base-court","bat-fowling","beef-witted","beetle-hea
@rjp
rjp / every20.sh
Created February 5, 2013 05:54
Reliably run snowcam.sh at :00/:20/:40 seconds
boot=$((SECONDS % 20))
time=$(($(date +%s) % 20))
offset=$((20-(time-boot)))
echo "boot=$boot time=$time offset=$offset"
while [ 1 ]; do
while [ $(((SECONDS-offset) % 20)) -lt 18 ]; do sleep 1; done
while [ $(((SECONDS-offset) % 20)) -lt 19 ]; do echo >/dev/null; done
sleep 1
./snowcam.sh || exit
@rjp
rjp / RtR.md
Last active December 16, 2015 09:09

rjp's Road To Ruby.

I, rjp, do solemnly offer these my responses to The Road to Ruby Survey:

0. Briefly describe yourself?

Humanoid, halfway through expected lifecycle.

1. When did you first try Ruby seriously?

#! /usr/bin/perl
use Data::Dumper;
use CGI;
my $a = new CGI;
print $a->header('text/plain');
print Dumper($a);
print "XX ", $a->http('Host'), "\n";
print "YY ", $ENV{'HTTP_HOST'}, "\n";
print "ZZ ", $a->http('Authorization'), "\n";
@rjp
rjp / gist:5583735
Last active December 17, 2015 08:59
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;
sub get_skillz {
@rjp
rjp / Bufferme.py
Created May 13, 2014 08:26
Bufferme
# -*- coding: utf-8 -*-
#!/usr/bin/env python
# Coded poorly by Brett Kelly
# http://nerdgap.com
# @inkedmn
# -*- coding: utf-8 -*-
import urllib2
import urllib
#!/usr/bin/env ruby -wKU
# Comments added 6 March 2014.
# Implementation of the MetaWeblog API for my personal Ruby static blog generator.
# This is not even nearly idiomatic Ruby. There are all kinds of issues.
# (What's with the method interiors all being mushed-up together?)
# But -- it's also worked flawlessly for five years without my having to edit it.
# It won't work for anyone else as-is — but if it helps anyone
# to do a MetaWeblog API implementation, then cool.
@rjp
rjp / reflow.sh
Created October 22, 2015 09:52
Reflow UTF8 text into quoted thin ASCII
pbpaste -Prefer txt | recode utf8..ascii | sed -e 's/\([^[:alnum:]]\)lb\([0-9]\)/\1GBP\2/g' | par w70 s0 p0 | sed -e 's/^/> /' | pbcopy