Skip to content

Instantly share code, notes, and snippets.

✌( ͡ᵔ ͜ʖ ͡ᵔ )✌

Max Ogden maxogden

✌( ͡ᵔ ͜ʖ ͡ᵔ )✌
Block or report user

Report or block maxogden

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
maxogden / map.geojson
Last active May 14, 2018
Temple City Bicycle Routes GeoJSON (Hand Mapped From Table In Adopted Bicycle Master Plan 2011)
View map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
maxogden / index.js
Created May 4, 2018
proxy multicast from one interface to another (node.js)
View index.js
// proxies from eth0 wlan0
var dgram = require('dgram')
var os = require('os')
var socket = dgram.createSocket({ type: 'udp4', reuseAddr: true })
socket.bind(5004, function () {
socket.addMembership('', getIpForInterface('eth0'))
maxogden /
Last active May 5, 2018
capture rtsp and create movie (ffmpeg)
# enable multicast route so ffmpeg can resolve 2nd interface data
sudo route add -net dev eth0
# grab 1 frame of video as jpg
run-every 60 ffmpeg -i udp://@ -f image2 -frames:v 1 -strftime 1 "%F-%H-%M-%S.jpg"
# convert jpgs to movie
rm -rf cropped
mkdir cropped
mogrify -path cropped/ -extract 1400x990+0+0 *.jpg
maxogden / index.js
Last active Dec 19, 2019
youtube playlist downloader
View index.js
var path = require('path')
var fs = require('fs')
var ytdl = require('youtube-dl')
function playlist (url) {
var video = ytdl(url) // add , ['--audio-format=mp3'] for mp3 only
video.on('error', function error (err) {
console.log('error 2:', err)
maxogden / index.js
Created Feb 27, 2018
read NCBI Blast seqdb sequence database .nin file metadata
View index.js
// $ node read.js nt.00.nin
var fs = require('fs')
var int53 = require('int53')
f = process.argv[2]
function read (fd, start, end, cb) {
var len = end - start + 1
var buf = new Buffer(len), buf, 0, len, start, function (err) {
cb(err, buf)
maxogden / Containerfile
Last active May 4, 2018
CALeDNA container (build with npm i mkcontainer -g)
View Containerfile
FROM ubuntu:xenial
# set unlimited bash history
# nspawn needs resolv.conf to be set up for internet to work
# password gets changed so we can login later
RUN mkdir /usr/local/anacapa && \
cd /usr/local/anacapa && \
echo "export HISTFILESIZE=" >> .bashrc && \
echo "export HISTSIZE=" >> .bashrc && \
maxogden / index.js
Created Sep 11, 2017
scrape millions of html files in a folder structure
View index.js
var $ = require('cheerio')
var fs = require('fs')
var walker = require('folder-walker')
var transform = require('parallel-transform')
var ndjson = require('ndjson')
var walk = walker('./pageblobs') // generated by abstract-blob-store
var scraper = transform(10, scrape)
var out = ndjson.serialize()
maxogden / index.js
Last active Sep 5, 2017
hyperdb sparse get
View index.js
var hyperdb = require('hyperdb')
var hyperdiscovery = require('hyperdiscovery')
var npmkey = '0f8a60595af5387d52b053af4a8a4aecd5d6d3799741c3993916798e71ea0730'
var db = hyperdb('./npm.db', npmkey, {sparse: true, valueEncoding: 'json'})
db.on('ready', function () {
var swarm = hyperdiscovery(db, {live: true})
db.once('remote-update', function () {
db.get('/modules/aws.js', function (err, data) {
View index.js
var fs = require('fs')
var request = require('request')
var through = require('through2')
var ndjson = require('ndjson')
var once = require('once')
var pump = require('pump')
var concat = require('concat-stream')
var parallel = require('parallel-transform')
var hyperdb = require('hyperdb')
var db = hyperdb('./npm.db', {valueEncoding: 'json'})
maxogden /
Last active Aug 16, 2017
filtering and converting geojson to shapefiles and back
// data from geojson lines file from
cat portland_oregon_osm_line.geojson | jsonfilter features.* > lines.ndjson
cat lines.ndjson | jsonfilter --match=" && !== 'no'" > sharedpaths.json
cat lines.ndjson | grep "cycleway" >> sharedpaths.json
cat sharedpaths.json | sort | uniq > dedupe.json
mv dedupe.json sharedpaths.json
cat sharedpaths.json | ndjson-reduce | ndjson-map '{type: "FeatureCollection", features: d}' > sharedpaths.geojson
mkdir shp
cd shp
ogr2ogr -f "ESRI Shapefile" sharedpaths.shp ../sharedpaths.geojson OGRGeoJSON
You can’t perform that action at this time.