Skip to content

Instantly share code, notes, and snippets.

icio is typing...

Paul Scott icio

icio is typing...
View GitHub Profile
icio /
Last active Dec 22, 2021
Converting integers to timestamps

Table of integers and how they convert into timestamps at different resolutions.

A indicates the timestamp is within the range 0000-00-00T00:00:00Z to 9999-12-31T23:59:59.9999 which is considered valid by Google BigQuery.

The number 253402300799 is the unix timestamp (number of seconds since 1970-01-01T00:00:00Z) until 9999-12-31T23:59:59.9999 and is the recommended switch to the next resolution.

               input @ unit = time                 |          input * 1ns   |             input * 1µs   |                input * 1ms   |                   input * 1s  
-9223372036854775808 @  1ns = 1677-09-21T00:12:43Z | 1677-09-21T00:12:43Z ✓ | -290308-12-21T19:59:05Z   | -292275055-05-16T16:47:04Z   | 292277026596-12-04T15:30:08Z  
  -62135596800000000 @  1µs = 0001-01-01T00:00:00Z | 1968-01-12T20:06:43Z ✓ |    0001-01-01T00:00:00Z ✓ |   -1967029-04-28T00:00:00Z   |  -1968996709-01-15T00:00:00Z  
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