Skip to content

Instantly share code, notes, and snippets.

Michael Wills michaelwills

Block or report user

Report or block michaelwills

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
@michaelwills
michaelwills / pr.md
Created Feb 17, 2018 — forked from piscisaureus/pr.md
Checkout github pull requests locally
View pr.md

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 Feb 23, 2016
sphinx 4 audio preparation snippets
View snippets.sh
# 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 Dec 11, 2015
JAWS (now) serverless/serverless handling of SNS events
View README.md

@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 Dec 11, 2015
serverless/serverless framework testing .env file
View .env.sh
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 Dec 10, 2015
Inject jquery and lodash into current page
View jquery-lodash-injector.js
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 Dec 9, 2015
append git commit to index.html with gulp
View append-commit.js
// 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 Nov 24, 2015 — forked from timnew/gist:3137257
Inject Javascript to current page
View inject.js
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 Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.