Skip to content

Instantly share code, notes, and snippets.

icio is typing...

Paul Scott icio

icio is typing...
View GitHub Profile
icio / usego
Created Feb 19, 2021
usego script for installing any Go version (including tip) into ~/sdk using
View usego
set -eu
VERS="${1:?Usage: $0 1.x.x}"
test -d ~/sdk || mkdir ~/sdk
cd ~/sdk
unset GOROOT
go get$VERS
go$VERS download
test -d go && rm go
ln -s go$VERS go
icio / repo_test.go
Created Jan 14, 2021
Hooking into Go SQL drivers for triggering race conditions
View repo_test.go
package repo_test
import (
icio / ignore_test.go
Last active Dec 8, 2017
Example of using sentinel values with
View ignore_test.go
package example_test
import (
from Queue import Queue
def select(source, selector, unselected, sentinel):
for item in source:
if selector(item):
yield item
icio /
Created Feb 8, 2017 — forked from anonymous/
Go: Reflecting valid values
$ go run valid.go
main.Thing{Age:sql.NullInt64{Int64:99, Valid:true}, Lender:(*sql.NullString)(nil), Blue:sql.NullBool{Bool:false, Valid:false}}:
- Age: 99
main.Thing{Age:sql.NullInt64{Int64:1, Valid:true}, Lender:(*sql.NullString)(0xc82008a000), Blue:sql.NullBool{Bool:false, Valid:false}}:
- Age: 1
&main.Thing{Age:sql.NullInt64{Int64:0, Valid:false}, Lender:(*sql.NullString)(0xc82008a020), Blue:sql.NullBool{Bool:false, Valid:false}}:
- Lender: "Friend"
&main.Thing{Age:sql.NullInt64{Int64:0, Valid:false}, Lender:(*sql.NullString)(nil), Blue:sql.NullBool{Bool:true, Valid:true}}:
- Blue: true
&main.Thing{Age:sql.NullInt64{Int64:44, Valid:true}, Lender:(*sql.NullString)(0xc82008a080), Blue:sql.NullBool{Bool:false, Valid:true}}:
function go-local-package() {
go list ./... | head -1 | xargs dirname
function go-diff() {
go list -f '{{.Name}} {{.ImportPath}} {{.Deps}}' $(go list $ROOT_PKG/...) | \
grep ^main | \
grep -w -f <(
git diff --dirstat ${2:-master}...${1:-HEAD} | \

Keybase proof

I hereby claim:

  • I am icio on github.
  • I am icio ( on keybase.
  • I have a public key ASBBQCsu980HaJfo_B6E2_2q5i6miC4B7Ho28ym7fYx7kQo

To claim this, I am signing this object:

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 / .bashrc
Last active Jan 31, 2020
View .bashrc
#!/usr/bin/env bash
function run_scripts() {
for script in $1/*; do
# skip non-executable snippets
[ -x "$script" ] || continue
# execute $script in the context of the current shell
. $script
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