Skip to content

Instantly share code, notes, and snippets.

View flesch's full-sized avatar

John Flesch flesch

View GitHub Profile
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: Keybase OpenPGP v2.0.68
Comment: https://keybase.io/crypto
xsFNBFkGn6ABEADN2FeOuMYzkAA7LA0IY0pG4yB8gcQ95A9uuSjPuk+rUxSpmQP+
Sa3pnYxqr30NGs88aZPJgxZlV/JE01ZhYGxIJVnI4zfm7j297eDP6L75UH4GhxuK
uBhZlTuUbTKN8R1TJ6GoiD1o6uePDkaPaj5JyF2EDpO2nCqGgCg3JxAeFlJdM5fb
fhSrdexSv4iO14do65VoVCQ3P3tRQx97lJGOoCfARs/U0s3/zQAEM+2FXGP19qQG
JIT+mLKBlWxgpRFhCV/7u5BgFgUsXJsOG5dhKAfOi5L5g1fY6Io6CcBLiu4mt0Gw
yuXNvIYH5AxrpiCyi8d77rFTDhvsDUmNdNLCmhzY6rgwGEl5qLTkHCT8ok7TiPPX
@flesch
flesch / node-lambda-babel-template-download.js
Last active September 17, 2016 02:24
Download a version of the "node-lambda-babel-template".
'use strict';
import { get } from 'gh-got';
// curl -o- https://ribjyr1g9l.execute-api.us-east-1.amazonaws.com/nodelambdababeltemplate/latest | bash
export default async (event, context, callback) => {
const repo = 'node-lambda-babel-template';
const tarball = `https://api.github.com/repos/flesch/${repo}/tarball`;

Keybase proof

I hereby claim:

  • I am flesch on github.
  • I am flesch (https://keybase.io/flesch) on keybase.
  • I have a public key ASA-RxwYOV9ylMRAuuixIdEoQzt2ptrhV5uxThnE4PW-9go

To claim this, I am signing this object:

@flesch
flesch / vztube.js
Last active October 30, 2015 19:24
var domains = ['vztube.verizon.com', 'vztube.vzwcorp.com', 'vztube.verizonwireless.com'];
function getFirstAccessibleDomain(callback) {
var domain = domains.shift();
var image = document.createElement('img');
image.onload = function(){ callback(null, domain); };
image.onerror = function(){
if (domains.length) {
getFirstAccessibleDomain(callback);
} else {
@flesch
flesch / .wakeup
Last active November 28, 2017 18:19
Reconnect to a Wi-Fi network upon waking up (using SleepWatcher)
#!/bin/sh
# Reconnect to a Wi-Fi network upon waking up.
WIFI_SSID=EDIT_WIFI_SSID
WIFI_PASSWORD=EDIT_WIFI_PASSWORD
airport=/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
interface=$(networksetup -listallhardwareports | grep -A1 Wi-Fi | awk '/Device:/ {print $2}')
attempts=0
@flesch
flesch / mkv2mp4.sh
Last active August 29, 2015 14:10 — forked from ravnoor/mkv2mp4.sh
Convert Matroska MKV to iTunes compatible MP4 format for Airplay streaming on AppleTV. (http://git.io/mkv2mp4)
#!/bin/bash
# brew install libav
# curl -fsSL http://git.io/mkv2mp4sh | sh
for mkv in *.mkv; do
mp4="$(basename --suffix=.mkv "$mkv").mp4"
avconv -i "$mkv" -c:v copy -c:a aac -strict experimental -threads auto "$mp4"
done
@flesch
flesch / deprecate-console-test.js
Created November 20, 2014 17:44
Deprecate `console.log` in favor of node-bunyan.
var deprecate = require('depd')('bunyan')
, bunyan = require('bunyan')
;
// Bunyan logger used by the app.
var logger = bunyan.createLogger({ name:'app', level:'debug' });
// Bunyan logger to catch only the console.
var depdconsole = bunyan.createLogger({ name:'console', level:'warn' });
@flesch
flesch / cluster.js
Last active January 2, 2016 03:38
eval $([ -f .env ] && cat .env) node cluster.js
var cluster = require('cluster')
, express = require('express')
, app = express()
, cpus = require('os').cpus().length;
app.get('/', function(req, res, next){
res.json({ "env":process.env.NODE_ENV || "development", "pid":cluster.worker.process.pid });
});
if (cluster.isMaster) {