Skip to content

Instantly share code, notes, and snippets.

View L1fescape's full-sized avatar

Andrew Kennedy L1fescape

View GitHub Profile

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

; Map ctrl-backspace to delete (similar to MacOS)
^BS::
Send {DEL}
return
; Map Caps lock to escape
Capslock::Esc
; Toggles default audio device in Control Panel (switches between headset and speakers).
!s::
@L1fescape
L1fescape / dev_tools_remove
Created November 30, 2014 21:15
Remove all elements matching a selector from the page in dev tools
var tags = $$('some selector');
for( var i = 0, len = tags.length; i < len; i++){
tags[i].parentNode.removeChild(tags[i]);
}
@L1fescape
L1fescape / fork_request.md
Last active August 29, 2015 14:08
Check out Pull Requests on a fork

Add the repo you forked from as a remote

Throw this in terminal:

$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

Setup the repo to track pull requests on the remote

Open up the repo's .git/config.

Keybase proof

I hereby claim:

  • I am akenn on github.
  • I am akenn (https://keybase.io/akenn) on keybase.
  • I have a public key whose fingerprint is 8B0F 40D4 1F7B 1C4C A459 5D0D 1EE2 6423 F9B7 ED2B

To claim this, I am signing this object:

@L1fescape
L1fescape / swapJDK.sh
Created September 10, 2014 21:29
Swap JDK version on OSX
# Swap JDK versions
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
export JAVA_HOME=`/usr/libexec/java_home -v $@`
export PATH=$JAVA_HOME/bin:$PATH
fi
@L1fescape
L1fescape / gulpfile.js
Last active August 29, 2015 14:05
Seperate Gulp browserify and watchify tasks
'use strict';
var gulp = require('gulp');
var browserify = require('browserify');
var watchify = require('watchify');
var source = require('vinyl-source-stream');
var notify = require('gulp-notify');
// Helper functions
function handleErrors(){
var args = Array.prototype.slice.call(arguments);
@L1fescape
L1fescape / gist:2e58a1ad1a8753c26d5a
Created June 23, 2014 21:37
All keys in mongodb db. Not very efficient.
var keys = [];
db.domains.find().forEach(function(doc) {
for( key in doc ){
if( keys.indexOf(key) === -1 ){
keys.push(key);
}
}
});
print(keys);
function count_redir {
curl -L -I -D - -o /dev/null $1 | awk 'BEGIN { redir = 0; status = 200; } tolower($1) ~ /http/ { redir=redir+1; status=$2 } tolower($1) ~ /location:/ { print redir, status, $2 } END { print "Completed, with ", redir-1, "redirects. Final result: ", status }'
}
// npm install request
var request = require('request'),
redirectCount = 0;
function printRedirects(site) {
request(site, {followRedirect: false}, function (error, response, body) {
if (error){
console.log(error);
return;
}