Skip to content

Instantly share code, notes, and snippets.

icio is typing...

Paul Scott icio

icio is typing...
View GitHub Profile
icio / tfl.go
Last active Apr 16, 2016
TfL Journey History
View tfl.go
// I take the tube in this morning to start collecting from data.
main.Payment{Origin:"Bethnal Green LU", Destination:"Liverpool Street LU", Cost:240}
// Later, I get on at Liverpool street, and when checking immediately after
// exiting Bank. Tfl have gotten this journey WRONG. Due to the absence of a
icio /
Last active Jan 16, 2016
Jawa Pockets

As you cruise along the vast expanses of Tatooine desert, your X-34 landspeeder begins to splutter and stutter, before drifting slowly to a halt. A brief scan of the horizon reveals few features you can aim for in search of rescue.

Miraculously, a troop of Jawas appear out of nowhere -- presumably masked by the heat waves engulfing all who dare make this journey. The Jawas, being the scavengers they are, can be identified by the clattering of their many belongings. You strike up a conversation with one of the shorter ones, who is willing to trade some supplies you can use to fix your vehicle in exchange for some help with their counting.

Each Jawa's cloak contains many pockets. Many of those pockets (which aren't nearly as wet as an Otter's) contain pockets themselves, which themselves may contain pockets, and so-forth. The Jawas need your help to determine how many items they own altogether.

The pockets are represented as an array of the number of items within the pocket, and pockets which contain other p

icio /
Created Jan 6, 2016
Python enter_context
"""Imperative enter/exit control for python contextmanagers.
Where you'd prefer to use `with`:
with my_context(123) as f:
but only have access to before and after hook-functions (as with Flask):
def before_hook():
icio / inputrc
Created Jan 22, 2014
Ubuntu input rc
View inputrc
# /etc/inputrc - global inputrc for libreadline
# See readline(3readline) and `info rluserman' for more information.
# Be 8 bit clean.
set input-meta on
set output-meta on
set completion-ignore-case on
set expand-tilde off
set mark-directories on
icio / azure.txt
Last active Jan 3, 2016
Azure IP ranges from converted into a format for Cloudflare's threat control.
View azure.txt
icio / jira-issue-map-copy.js
Created Jan 10, 2014
Useful for when you have to move from one JIRA workflow to another but don't want to repeat the mapping for every fucking issue type.
View jira-issue-map-copy.js
* Duplicate the mapping of Current Status to New Status from the first
* issue type to the subsequent issue types.
var tbody = document.getElementById('workflow-mapping-table').querySelector('tbody');
var cell = tbody.appendChild(document.createElement('tr')).appendChild(document.createElement('td'));
cell.setAttribute("colspan", 3); = "right";
icio /
Created Jan 5, 2014
Python command-line tile world for unix terminals
#!/usr/bin/env python
def world():
world = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 1, 0, 0, 0, 1],
icio /
Last active Oct 13, 2015
Git review


A utility for interfacing with reviewable git branches, as per GitHub issues. This is a wrapper around ghi.


git review [-h | -l [LABEL] | [-w] ISSUE | -s | -u]
   git review            List reviewable issues
   git review -h         Print usage instructions
   git review -l         Print the review label filtered by
icio / gist:3166670
Created Jul 23, 2012
Python for/else
View gist:3166670
# For and if
for module in self.modules.values():
ok = True
for f in filters:
if not f(module):
ok = False
if ok:
yield module
View delay.js
var _log_start =;
* Helper for logging which prepends a time-offset
function log()
console.log.apply(console, ["["+("]"].concat(args(arguments)));