Skip to content

Instantly share code, notes, and snippets.

View missinglink's full-sized avatar

Peter Johnson missinglink

View GitHub Profile
@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 / 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 / pelias-repos.md
Last active August 29, 2015 14:05
Pelias related repositories
# 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
http://localhost:9200/_nodes/_all?pretty=t
http://localhost:9200/_all/_settings
@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
@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);";

npm publish actually zips up your module directory and sends the zip to be stored on the npm servers. if you have passwords and large files in your working directory they may be included in the zip unless you add them to a .npmignore (if an .npmignore is not present it will check .gitignore instead)

on github:

  • merge PR to master

locally:

  • switch to master branch important
  • pull origin master locally important
@missinglink
missinglink / aggregations.sh
Created December 1, 2014 09:53
aggregate per-region index statistics for pelias.
#!/bin/bash
curl -s -X POST "localhost:9200/pelias/_search?pretty=true&search_type=count" -d '
{
"size": 0,
"aggs": {
"group_by_a3": {
"terms": {
"field": "alpha3"
},
@missinglink
missinglink / lookup.url
Created December 12, 2014 14:38
GEO IP
http://bits.wikimedia.org/geoiplookup