Skip to content

Instantly share code, notes, and snippets.

View missinglink's full-sized avatar

Peter Johnson missinglink

View GitHub Profile
@missinglink
missinglink / wifipass.txt
Created January 27, 2017 14:23
hotel on rivington NYC, wifi pass downstairs in cafe
ssid: nest
pass: NESTNEST24
@missinglink
missinglink / oa_hash.sh
Last active January 4, 2017 13:39
openaddresses - set the 'hash' column to be the line number
awk -F"," 'BEGIN { OFS = "," } FNR < 2 { print; next } {$11=sprintf("%.6d", NR); print}' test/functional/west26th/oa.csv > test/functional/west26th/foo.txt
@missinglink
missinglink / crontab.example
Last active December 17, 2016 14:21
use any Philips hue bulb / light as a LED wakeup light similar to the Philips HF3531/01
# m h dom mon dow command
40 7 * * 1-5 /home/pi/scripts/wakeup.sh
40 9 * * 6,0 /home/pi/scripts/wakeup.sh
function toRad(degree) { return degree * Math.PI / 180; }
function toDeg(radian) { return radian * 180 / Math.PI; }
// round floating point errors
function rnd( float ){
return (Math.floor(100000 * float) / 100000).toFixed(5);
}
function assert( a, b ){
@missinglink
missinglink / concat_oa.sh
Last active December 11, 2016 04:25
concat all openaddresses csv files in to a single file
#!/bin/bash
# concatenate all openaddresses csv files in to a single stream
# note: deduplicates lines in each file
# avoid locale issues with the sort command
export LC_ALL=C;
# base path of openaddresses file system
OAPATH='/data/oa';
@missinglink
missinglink / wrap.js
Last active October 1, 2025 20:37
wrap latitude and longitude values around the poles in order to normalize their ranges
/**
normalize co-ordinates that lie outside of the normal ranges.
longitude wrapping simply requires adding +- 360 to the value until it comes
in to range.
for the latitude values we need to flip the longitude whenever the latitude
crosses a pole.
**/
@missinglink
missinglink / timezone.sh
Created June 28, 2016 07:29
timezones are hard
date --date='TZ="Europe/Berlin" 09:00 next Fri'
@missinglink
missinglink / concurrency-1.txt
Created June 6, 2016 11:40
benchmark tests of pippi point-in-polygon service
$ ab -c1 -n100 "http://localhost:8080/point?lat=51.533&lon=-0.0652280"
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient).....done
Server Software:
Server Hostname: localhost
@missinglink
missinglink / convert.sh
Created March 9, 2016 19:47
convert jpg files to pdf resized for A4
convert -compress jpeg -resize 1240x1753 -units PixelsPerInch -density 150x150 one.jpg two.jpg out.pdf
@missinglink
missinglink / ordinals.go
Last active January 12, 2016 18:48
remove ordinals eg. '21st' -> '21', strict in enforcing rules and supports autocomplete
package token
import "regexp"
// Ordinals - remove ordinals (such as the 'st' from '21st')
func Ordinals(tokens []string) []string {
r := []string{}
var reg = ""
reg += "(?i)" // case insensitive