Skip to content

Instantly share code, notes, and snippets.

@chrismytton
chrismytton / 01-README.md
Created October 29, 2012 20:46
Mutt Gmail config with OS X keychain

Mutt/Gmail/OS X Keychain

Create a new keychain item, enter the Keychain Item Name as mutt, the Account Name as your gmail email address and then enter your password, then add the keychain item.

2-step auth

If you're using Google 2-step auth, you'll need to generate an Application-specific password from your Google Account settings and enter that as the password.

@chrismytton
chrismytton / gist:4754032
Last active July 8, 2021 22:14
Shell find and replace.
# Usage: find-replace <search> <replacement>
find-replace () {
ag -l $1 | xargs sed -i '' -e "s/$1/$2/g"
}
@chrismytton
chrismytton / yaml2json.sh
Created October 19, 2016 15:32
Shell function to convert YAML to JSON
yaml2json () {
ruby -r yaml -r json -e 'puts YAML.load($stdin.read).to_json'
}
@chrismytton
chrismytton / php.vim
Created November 1, 2011 15:07
PHP settings for vim (place in ~/.vim/after/ftplugin/php.vim)
setlocal expandtab
setlocal tabstop=4
setlocal shiftwidth=4
setlocal softtabstop=4
@chrismytton
chrismytton / 01_basic.js
Created January 14, 2012 14:51
Bookmarklet templates for #rusichackday
/**
* Basic bookmarklet template.
*
* Change the `iframeSrc` variable to point to your space's new idea
* page. You can adjust the iframe styles and position using the
* `iframeStyle` variable.
*
* For turning this script into a bookmarklet, you should probably take
* a look at https://gist.github.com/1856012.
*/
@chrismytton
chrismytton / Pow.md
Created December 18, 2012 22:45
Using chruby with pow

chruby can be used with [pow] to select a specific Ruby per project, or system-wide.

System wide

To set a default Ruby for all pow apps, puts the following in ~/.powconfig.

~/.powconfig

@chrismytton
chrismytton / init.lua
Created March 5, 2017 12:26
Hammerspoon version of Karabiner's "Control_L to Control_L (+ when you type Control_L only, send escape)"
-- Send escape when ctrl is tapped
local send_escape = false
local ctrl_pressed = false
hs.eventtap.new({hs.eventtap.event.types.flagsChanged}, function(event)
local flags = event:getFlags()
if flags["ctrl"] then
ctrl_pressed = true
send_escape = true
else
$ ruby benchmark.rb
user system total real
rcsv 1.420000 0.100000 1.520000 ( 1.514617)
csv 11.450000 0.350000 11.800000 ( 11.838005)
@chrismytton
chrismytton / rerun_all_reviews.bash
Created April 5, 2016 17:00
Rerun the review_changes app over all open PRs
heroku run -- \
ruby -r ./app -e \
'ARGV.each { |pr| PullRequestReview.perform_async(pr.to_i) }' \
$(curl -s 'https://api.github.com/repos/everypolitician/everypolitician-data/pulls?per_page=100' | jq '.[] | .number')
id name qualification
3 Edward G. Cross Diploma in Agriculture
3 Edward G. Cross B Sc. Honours in Economics
10 Thamsanqa Mahlangu Advanced Diploma in Purchasing and Supply
10 Thamsanqa Mahlangu Diploma in Stores Management
10 Thamsanqa Mahlangu Journeyman Certificate in Carpentry
19 Fani Munengami Diploma in Marketing, Public Relations and Advertising
22 Tendai Biti Bachelor of Laws (LLB)
25 Fungai J Majome Post Graduate Diploma
25 Fungai J Majome Bachelor of Laws (LLB)