Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt H matthewhochler

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

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 Jan 1, 2016 — forked from JoelBesada/README.md
Bookmark current URL in Pinboard, with pop-up window. Custom bookmarklet for Backtick (http://backtick.io/).
View command.js
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 Jan 1, 2016
Bookmark current URL in Pinboard as 'Unread,' with no pop-up or option for tags. Custom bookmarklet for Backtick (http://backtick.io/).
View command.js
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 Dec 26, 2013
Custom bookmarklet for Backtick (http://backtick.io/). Add current site's RSS to Feed Wrangler.
View command.js
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 Jan 4, 2016 — forked from al3xandru/gist:1169583
Add to OmniFocus Bookmarket
View add_to_omnifocus-oneliner.js
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 Jan 29, 2016 — 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/`.
View post-merge
#/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 Mar 25, 2016
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
View guard-my-mabook-when-i-am-away.sh
#!/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
View file2kindle
#!/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 — forked from reyjrar/elasticsearch.yml
ElasticSearch config for a write-heavy cluster
View elasticsearch.yml
##################################################################
# /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