Skip to content

Instantly share code, notes, and snippets.

@michaelwills
michaelwills / pr.md
Created February 17, 2018 05:18 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@michaelwills
michaelwills / snippets.sh
Last active February 23, 2016 09:28
sphinx 4 audio preparation snippets
# use ffmpeg to extract audio from video file
% ffmpeg -i infile.mp4 -acodec pcm_s16le -ac 1 -ar 16000 outfile.wav
# use sox to convert to raw
sox infile.wav -b 16 -s -c 1 -r 16k -t raw outfile.raw
# https://trac.ffmpeg.org/wiki/audio%20types
# use ffmpeg to extract RAW! audio from video file
ffmpeg -i input -f s16le -acodec pcm_s16le output.raw
% ffmpeg -i infile.mp4 -f s16le -acodec pcm_s16le -ac 1 -ar 16000 outfile.raw
@michaelwills
michaelwills / README.md
Created December 11, 2015 02:33
JAWS (now) serverless/serverless handling of SNS events

@kfreytag responding to @Nopik

Responding to your question from early this morning about SNS-triggered lambdas. In my experience, you only get one message / Record at a time. Here’s my revised JAWS handler wherein I always deal with a JobId

@michaelwills
michaelwills / .env.sh
Last active December 11, 2015 06:39
serverless/serverless framework testing .env file
TEST_SERVERLESS_EXE_CF=false
TEST_SERVERLESS_EMAIL=YOUR_EMAIL
TEST_SERVERLESS_REGION1=us-east-1
TEST_SERVERLESS_REGION2=us-west-2
TEST_SERVERLESS_STAGE1=development
TEST_SERVERLESS_STAGE2=production
TEST_SERVERLESS_LAMBDA_ROLE=ARN_FROM_A_PROJECT
TEST_SERVERLESS_AWS_ACCESS_KEY=YOUR_KEY
TEST_SERVERLESS_AWS_SECRET_KEY=YOUR_SECRET
NPM_BIN="/path/to/node /path/to/npm"
@michaelwills
michaelwills / jquery-lodash-injector.js
Created December 10, 2015 10:38
Inject jquery and lodash into current page
javascript: (function () { var jv = '2.1.4'; var lv = '3.9.3'; var el = document.createElement('pre'), b = document.getElementsByTagName('body')[0], otherjQuery = false, msg = '', libs = [ function loadjQuery() { if (typeof jQuery != 'undefined') { showMsg('This page already using jQuery v' + jQuery.fn.jquery); } else { if (typeof $ == 'function') { otherjQuery = true; } getScript('//cdnjs.cloudflare.com/ajax/libs/jquery/' + jv + '/jquery.js', function () { if (typeof jQuery == 'undefined') { showMsg('Sorry, but jQuery wasn\'t able to load') } else { showMsg('This page is now jQuerified with v' + jQuery.fn.jquery + otherjQuery ? ' and noConflict(). Use $jq(), not $().' : ''); } }); } }, function loadLodash() { if (typeof _ != 'undefined') { showMsg('This page already using lodash v' + _.VERSION); } getScript('//cdnjs
@michaelwills
michaelwills / append-commit.js
Created December 9, 2015 10:43
append git commit to index.html with gulp
// http://stackoverflow.com/a/27084400
var gulp = require('gulp'),
git = require('gulp-git'),
cheerio = require('gulp-cheerio');
var gitHash;
gulp.task('hash', function(cb) {
return git.revParse({args:'--short HEAD'}, function(err, hash) {
@michaelwills
michaelwills / inject.js
Last active November 24, 2015 12:59 — forked from timnew/gist:3137257
Inject Javascript to current page
javascript:var s = 'http://code.jquery.com/jquery-1.7.2.min.js'; var b=document.body;if(b){void(z=document.createElement('script'));void(z.type='text/javascript');void(z.src=s);void(b.appendChild(z));}else{}
@michaelwills
michaelwills / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console