Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Williams sjwilliams

View GitHub Profile
@sjwilliams
sjwilliams / imgix_purge_node.js
Created May 3, 2016
Purging Imgix CDN with node.js
View imgix_purge_node.js
var Curl = require( 'node-libcurl' ).Curl;
var querystring = require( 'querystring' );
var IMGIX_API_KEY = '';
function imgixPurge(url){
var curl = new Curl();
curl.setOpt(Curl.option.URL, 'https://api.imgix.com/v2/image/purger');
curl.setOpt('HTTPAUTH', Curl.auth.BASIC);
curl.setOpt(Curl.option.USERNAME, IMGIX_API_KEY);
curl.setOpt(Curl.option.TIMEOUT, 20);
View git-go.js
#!/usr/bin/env node
var cmds = [];
if (process.argv.length < 3) {
console.log('You need to provide a commit message!');
process.exit(-1);
}
cmds.push('git add -A');
cmds.push('git add -u');
View states_hash.json
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
View kebase.md

Keybase proof

I hereby claim:

  • I am sjwilliams on github.
  • I am sjwilliams (https://keybase.io/sjwilliams) on keybase.
  • I have a public key whose fingerprint is 7D91 C398 0D0A BB03 0767 F3C6 DB12 92DB A0ED B42D

To claim this, I am signing this object:

View gist:a565012044323170e4e7
http://cfenollosa.com/misc/tricks.txt
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
BASH
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command < file.in' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
View gist:4b23f60fc451e7e8c59e
ffmpeg -i intro.mov -vf "boxblur=5:1" intro-blur.mov
@sjwilliams
sjwilliams / dropaudio
Last active Aug 29, 2015
Use FFmpeg to drop audio from video
View dropaudio
ffmpeg -i [input_file] -vcodec copy -an [output_file]
# or on a bunch of files
for i in *; do ffmpeg -i $i -vcodec copy -an ~/path/to/out/$i; done
@sjwilliams
sjwilliams / gist:11191701
Created Apr 22, 2014
Simple file renaming with mmv
View gist:11191701
# http://stackoverflow.com/questions/417916/how-to-do-a-mass-rename
brew install mmv
mmv "*.mustache.html" "#1.jst.html"
View umd-module.js
umd(function(require, exports, module) {
//...
},'my-module');function umd(fn,n){
if(typeof define=='function')return define(fn); // AMD
if(typeof module=='object')return fn(require,exports,module); // CommonJS
var m={exports:{}};window[n]=fn(function(n){return window[n];},m.exports,m)||m.exports; // window
}
@sjwilliams
sjwilliams / imagesToMp4
Created Jan 20, 2014
rename a folder of image to be sequential, then convert to an mp4
View imagesToMp4
find . -name '*.JPG' | awk 'BEGIN{ a=1 }{ printf "mv %s %04d.jpg\n", $0, a++ }' | bash;
ffmpeg -r 24 -f image2 -s 1920x1280 -i %4d.jpg -vcodec libx264 -crf 15 test.mp4
You can’t perform that action at this time.