Skip to content

Instantly share code, notes, and snippets.

View Govan's full-sized avatar

Gavin Montague Govan

View GitHub Profile
//============= Move Durations from titles back into Estimates
Omnifocus = Application("OmniFocus");
Omnifocus.includeStandardAdditions = true;
app = Application.currentApplication()
app.includeStandardAdditions = true
app.displayNotification("I'm about to parse durations from titles back into tasks", {withTitle: "OF2 Cleanup"})
document = Omnifocus.documents()[0];
OpenSSL Security Advisory [19 Mar 2015]
=======================================
OpenSSL 1.0.2 ClientHello sigalgs DoS (CVE-2015-0291)
=====================================================
Severity: High
If a client connects to an OpenSSL 1.0.2 server and renegotiates with an
invalid signature algorithms extension a NULL pointer dereference will occur.
class User
has_many :group_roles
has_many :groups, :through=>:group_roles
end
class GroupRole
belongs_to :user
belongs_to :group
end
@Govan
Govan / gist:4272489
Created December 12, 2012 23:02
Clean up OS X's open with... menu open. This will kill the cache and thus get rid of double entries.
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
@Govan
Govan / chefstrap.sh
Created October 15, 2012 19:31
Chef Workstation bootstrap for the .NET magazine article
cd ~;
apt-get install git;
git clone git://github.com/opscode/chef-repo.git;
mv chef-repo workstation;
cd workstation;
mkdir .chef;
@Govan
Govan / gist:1308744
Created October 24, 2011 10:33
Gavin's Tmux config
setw -g xterm-keys on
set -g default-terminal "xterm-color"
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/
set-option -g default-command "reattach-to-user-namespace -l bash"
# default statusbar colors
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
@Govan
Govan / gist:1185721
Created September 1, 2011 08:34
Tunnels
#!/bin/sh
ssh -nNT -R 1100:localhost:22 fake-remote.leftbrained.co.uk -p 2712 -i /Users/gavin/Dropbox/bin/reverse-tunnel.d/tunnel-key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
# Script above opens a reverse tunnel from laptop to fake-remote.leftbrained.co.uk
# from fake-remote.leftbrained.co.uk (a VPS I use for general cruft work) I can do...
$ ssh localhost -p1100
# That uses the outbound tunnel from laptop to fake-remote to go from fake-remote to laptop.
@Govan
Govan / A quote
Created September 30, 2010 11:51
Taken from http://en.wikipedia.org/wiki/Hanlon's_razor
A practical observation on the risks of stupidity was made by the German General Kurt von Hammerstein-Equord
in Truppenführung, 1933: "I divide my officers into four classes; the clever, the lazy, the industrious, and
the stupid. Each officer possesses at least two of these qualities. Those who are clever and industrious are
fitted for the highest staff appointments. Use can be made of those who are stupid and lazy. The man who is
clever and lazy however is for the very highest command; he has the temperament and nerves to deal with all
situations. But whoever is stupid and industrious is a menace and must be removed immediately!"
@Govan
Govan / doc2pdf.scpt
Created June 25, 2010 19:43
Applescript to batch convert .doc files to .pdf, more details here http://www.leftbrained.co.uk/articles/show/batch-converting-doc-files-to-pdf
set thefolder to choose folder with prompt "Pick a folder..."
tell application "Finder" to set filelist to every file of thefolder
repeat with currentFile in filelist
tell application "Pages"
open currentFile
activate
save front document in (name of currentFile) & ".pdf"
close front document without saving
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AbandonProcessGroup</key>
<true/>
<key>Label</key>
<string>uk.co.leftbrained.iteleport_watcher</string>
<key>ProgramArguments</key>
<array>