Skip to content

Instantly share code, notes, and snippets.

View DamonOehlman's full-sized avatar

Damon Oehlman DamonOehlman

View GitHub Profile
@addyosmani
addyosmani / headless.md
Last active May 1, 2024 03:05
So, you want to run Chrome headless.

Update May 2017

Eric Bidelman has documented some of the common workflows possible with headless Chrome over in https://developers.google.com/web/updates/2017/04/headless-chrome.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

@dominictarr
dominictarr / CYPHERLINK.md
Last active April 24, 2024 16:17
Cypherlinks
@max-mapper
max-mapper / index.js
Last active May 9, 2021 02:20
fast loading of a large dataset into leveldb
// data comes from here http://stat-computing.org/dataexpo/2009/the-data.html
// download 1994.csv.bz2 and unpack by running: cat 1994.csv.bz2 | bzip2 -d > 1994.csv
// 1994.csv should be ~5.2 million lines and 500MB
// importing all rows into leveldb took ~50 seconds on my machine
// there are two main techniques at work here:
// 1: never create JS objects, leave the data as binary the entire time (binary-split does this)
// 2: group lines into 16 MB batches, to take advantage of leveldbs batch API (byte-stream does this)
var level = require('level')
@wolfeidau
wolfeidau / pi-build-deb.sh
Last active August 18, 2021 07:05
Build nodejs from source and assemble a deb package which installs on the Raspberry pi
#!/bin/bash
set -e
set -o errtrace
node_version="0.10.20"
source_bundle="http://nodejs.org/dist/v${node_version}/node-v${node_version}.tar.gz"
# store the location of the base working area.
@legastero
legastero / gist:7127532
Last active December 26, 2015 09:09
Where to find XMPP/Jingle in JS resources
@valueof
valueof / user.behaviors.clj
Last active January 4, 2016 18:49
LightTable Configuration
;; https://gist.github.com/antonkovalyov/8663025
{:+ {
;; The app tag is kind of like global scope. You assign behaviors that affect
;; all of Light Table here
:app [(:lt.objs.style/set-skin "light")]
;; The editor tag is applied to all editors
:editor [:lt.objs.editor/no-wrap
(:lt.objs.style/set-theme "solarized-light")
@ajfisher
ajfisher / firmatatest.js
Last active December 22, 2019 08:15
Serial comms over hardware UART for Johnny-Five between Arduino and a Raspberry Pi
var firmata = require('firmata');
var repl = require('repl');
var board = new firmata.Board('/dev/ttyAMA0',function(err){
//arduino is ready to communicate
if (err) {
console.log("err:" + err);
return;
}
console.log("Firmata Firing LEDs");
@ajfisher
ajfisher / a_nodebot_over_wifi.md
Last active April 21, 2022 23:57
WiFi your nodebot

Taking your nodebot wifi

Controlling your nodebot using a USB cable is great and all, and obviously you could shell out and grab a sparkcore or some other dedicated controller but what if you've got a standard arduino and you want to take an existing nodebot wireless?

Bluetooth is an option and there's this excellent JohnnyFive wiki entry that will help you there. Bluetooth can be a bit flaky though and it's range is pretty lousy. You can also look at things like XBees and what not using point to point serial, but these are expensive and very fiddly to get working.

Really, what we want is a method of transferring data over a nice, simple, standard method, requiring little configuration, low cost and we can utilise a whole stack of the code we've already produced.

Enter the WiFi232 module. These little beauties are [available from AliExpress for $12 each](http://www.aliexpress.com/item/USR-WIFI232-T-wifi-to-uart-tt

@tmpvar
tmpvar / offset-minkowski-surface-nets.js
Last active August 29, 2015 14:02
offsetting adventures (run these with beefy!)
var Polygon = require('polygon');
var fc = require('fc');
var Vec2 = require('vec2');
var ndarray = require('ndarray');
var sn = require('surface-nets');
var cwise = require('cwise');
var fill = require('ndarray-fill');
var poly = new Polygon([
@morganherlocker
morganherlocker / voxel-openstreetmap.md
Last active August 29, 2015 14:05
voxel osm vector tile algo

This is a rough spec for an implementation of a realtime virtual world using OpenStreetMap data and voxel.js. The basic idea is to encode feature data pulled from Mapbox vector tiles as overzoomed tiles, which can be represented as voxels. This allows for easy scalability, since it utilizes existing algorithms and architecture.

The initial implementation is going on here.

###general

  • 1 voxel = 1 tile at zoom 17 = 1.1943 sq meters
  • the world is a 33,554,432 x 33,554,432 voxel grid
  • assume that a server is serving up vector tile pbfs at z15 (mapbox.com, local, etc.)
  • vector tiles are loaded at zoom 15 and geometry is encoded as 4096x4096 pixel coordinates, which is equivalent to tiles at zoom 24