Skip to content

Instantly share code, notes, and snippets.

View missinglink's full-sized avatar

Peter Johnson missinglink

View GitHub Profile
@missinglink
missinglink / openstreetmap-stream.sh
Last active August 29, 2015 14:06
stream the latest 26GB openstreetmap .pbf planet dump to a terminal near you; a bash one-liner courtesy of mapzen
#!/bin/bash
npm install openstreetmap-stream; curl -s http://planet.osm.org/pbf/planet-latest.osm.pbf | node -e "var osm = require('openstreetmap-stream'); process.stdin.pipe(osm.parser()).pipe(osm.stringify).pipe(process.stdout);";
@missinglink
missinglink / pbf-fixture.md
Last active August 29, 2015 14:06
A static OSM pbf fixture for testing purposes

download here: http://peter.johnson.s3.amazonaws.com/somes.osm.pbf

A static OSM pbf extract for testing purposes which contains the following data:

$ osmconvert --out-statistics somes.pbf 
lon min: 174.8607050
lon max: 174.8701924
lat min: -41.2637515
lat max: -41.2488235
http://localhost:9200/_nodes/_all?pretty=t
http://localhost:9200/_all/_settings
# sudo apt-get install osmctools
$ osmconvert --out-statistics planet-140820.osm.pbf
timestamp min: 2000-01-04T07:47:52Z
timestamp max: 2014-08-20T00:10:00Z
lon min: -180.0000000
lon max: 180.0000000
lat min: -90.0000000
lat max: 90.0000000
@missinglink
missinglink / pelias-repos.md
Last active August 29, 2015 14:05
Pelias related repositories
@missinglink
missinglink / simplify.sh
Last active August 29, 2015 14:05
Simplify shapefiles .shp
#!/bin/bash
ogr2ogr output-0001.shp input.shp -simplify 0.0001 -lco ENCODING=UTF-8
@missinglink
missinglink / dagu-arduino-bluetooth-ubuntu.md
Last active September 18, 2020 15:37
How I got the bluetooth serial connection working for the dagu arduino bluetooth module on ubuntu

It's useful to scan for your device. In a room with heaps of devices, you can turn yours on and off a few times to figure out your MAC.

$ hcitool scan
Scanning ...
	10:93:E9:0C:E8:2D	Raiden
	20:14:03:27:23:76	n/a
	00:17:E9:6A:BF:D4	Pebble BFD4
	78:31:C1:BF:B6:A9	James’s MacBook Pro
	B8:F6:B1:14:6F:BA	n
@missinglink
missinglink / esdocs.js
Created July 23, 2014 12:11
Crawl es documentation for curl syntax errors
/** Crawl documentation for curl syntax errors **/
// Requires nodejs and npm
// @see: https://github.com/isaacs/nave for easy installation
// @install nodejs: [sudo] bash nave.sh usemain stable
// @ref: https://github.com/missinglink/huntsman
// Usage:
// $> npm install huntsman
// $> node esdocs.js
@missinglink
missinglink / responder.js
Last active August 29, 2015 14:04
expressjs responders for JSON, CORS and JSONP
// send a reply that is capable of JSON, CORS and JSONP
function cors( req, res, obj ){
res.header('Charset','utf8');
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET');
res.header('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
res.header('Access-Control-Allow-Credentials', true);
// jsonp
if( req.query && req.query.callback ){
@missinglink
missinglink / pelias.conf
Created July 7, 2014 17:17
Pelias Upstart Script
#!upstart
description "pelias server"
author "wiz@wiz.co.nz"
start on startup
stop on shutdown
script
export HOME="/var/www/pelias-webview"
export NODE_ENV="production"