Skip to content

Instantly share code, notes, and snippets.

View matthewhochler's full-sized avatar

Matt H matthewhochler

View GitHub Profile
@matthewhochler
matthewhochler / gist:9ba777e2bbc608278f83
Created November 17, 2015 19:19 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@matthewhochler
matthewhochler / command.js
Last active January 1, 2016 08:09 — forked from JoelBesada/README.md
Bookmark current URL in Pinboard, with pop-up window. Custom bookmarklet for Backtick (http://backtick.io/).
javascript:q=location.href;if(document.getSelection){d=document.getSelection();}else{d='';};p=document.title;void(open('https://pinboard.in/add?url='+encodeURIComponent(q)+'&description='+encodeURIComponent(d)+'&title='+encodeURIComponent(p),'Pinboard','toolbar=no,width=700,height=350'));
@matthewhochler
matthewhochler / command.js
Last active January 1, 2016 08:09
Bookmark current URL in Pinboard as 'Unread,' with no pop-up or option for tags. Custom bookmarklet for Backtick (http://backtick.io/).
javascript:q=location.href;p=document.title;void(t=open('https://pinboard.in/add?later=yes&noui=yes&jump=close&url='+encodeURIComponent(q)+'&title='+encodeURIComponent(p),'Pinboard','toolbar=no,width=100,height=100'));t.blur();
@matthewhochler
matthewhochler / command.js
Created December 26, 2013 17:17
Custom bookmarklet for Backtick (http://backtick.io/). Add current site's RSS to Feed Wrangler.
javascript:javascript:%20(function%20()%20{var%20jsCode%20=%20document.createElement(%27script%27);jsCode.setAttribute(%27src%27,%20%27https://feedwrangler.net/add_bookmarklet.js%27);document.body.appendChild(jsCode);}());
@matthewhochler
matthewhochler / add_to_omnifocus-oneliner.js
Last active January 4, 2016 01:29 — forked from al3xandru/gist:1169583
Add to OmniFocus Bookmarket
javascript:(function(){var enc=encodeURIComponent,w=window,frames=w.frames,d=document,tn=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),pu=w.location.href,isGMail=w.location.host.match(/mail\.google\.com/),tt=pt=d.title,subjSpans=d.getElementsByClassName("hP"),i,url;if(isGMail){if(subjSpans){tt=subjSpans[0].innerText}else{tt=d.title.substring(d.title.indexOf("-")+1,d.title.lastIndexOf("-")).replace(/^ +/,"").replace(/ +$/,"")};if(tn!="")tn+="\n\n";tn+="From email subject:("+tt+")\n"+pu;pu="https://mail.google.com/mail/u/0/?qs=true&search=query&q=subject:("+enc(tt)+")"};url='omnifocus:///add?note='+enc(tn+"\n"+pu)+'&name='+enc(tt);w.location.href=url})();
@matthewhochler
matthewhochler / post-merge
Created January 29, 2016 20:04 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed. In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed. Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@matthewhochler
matthewhochler / 0_reuse_code.js
Created March 25, 2016 02:13
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
#!/bin/bash
#
# When you are working on your macbook sitting in cafe and you have to go pee,
# you need some way to guard you machine.
#
# Start this script, remove any earphones, and go do the job.
# The assumption is the thief will close the lid of the laptop before taking it away.
# This script detects the closing of the lid and plays some loud audio that will
# likely distract the thief and/or grab attention of nearby people, making the
#!/bin/bash
# Requires OS X with Homebrew
## Configuration ##
FROM_NAME=""
FROM_EMAIL=""
KINDLE_EMAIL=""
SMTP_HOST=""
SMTP_PORT="587"
@matthewhochler
matthewhochler / elasticsearch.yml
Created May 6, 2016 15:24 — forked from reyjrar/elasticsearch.yml
ElasticSearch config for a write-heavy cluster
##################################################################
# /etc/elasticsearch/elasticsearch.yml
#
# Base configuration for a write heavy cluster
#
# Cluster / Node Basics
cluster.name: logng
# Node can have abritrary attributes we can use for routing