Skip to content

Instantly share code, notes, and snippets.

View alexblackie's full-sized avatar

Alex Blackie alexblackie

View GitHub Profile
@alexblackie
alexblackie / private.xml
Created May 12, 2014 22:18
Play/Pause on non-apple keyboards
<?xml version="1.0"?>
<root>
<item>
<name>Play/Pause on Print</name>
<identifier>private.play_pause_on_printscreen</identifier>
<autogen>__KeyToKey__ KeyCode::F13, ConsumerKeyCode::MUSIC_PLAY</autogen>
</item>
<item>
<name>Enqueue play/pause Everywhere!</name>
@alexblackie
alexblackie / vagrant_function.sh
Created July 25, 2014 20:55
Run commands inside a Vagrant box with as little effort as possible.
# Put this your shellrc file (`.bashrc`, `.zshrc`, etc)
vs() {
args=$(printf "%s " "$@") # concatenate arguments into single string
vagrant ssh -c "$args"
}
-module(example_gs).
-behaviour(gen_server).
-export([start_link/0, init/1]).
-export([handle_call/3, handle_cast/2, handle_info/2]).
-export([code_change/3, terminate/2]).
start_link() ->
gen_server:start_link(?MODULE, [], []).
diff --git a/usr/bin/xdg-open.orig b/usr/bin/xdg-open
index 7218fee..53cd90a 100755
--- a/usr/bin/xdg-open.orig
+++ b/usr/bin/xdg-open
@@ -643,7 +643,7 @@ search_desktop_file()
args=$(( $args - 1 ))
done
[ $replaced -eq 1 ] || set -- "$@" "$target"
- "$command_exec" "$@"
+ eval $("$command_exec" "$@")
@alexblackie
alexblackie / lol_ubuntu.sh
Last active September 7, 2015 23:19
First step after installing Ubuntu (14.04)
sudo apt-get remove -y unity-scope-virtualbox unity-scope-yelp unity-scope-zotero unity-scope-texdoc unity-scope-tomboy unity-scope-video-remote unity-scope-musicstores unity-scope-musique unity-scope-openclipart unity-scope-manpages unity-scope-guayadeque unity-scope-gdrive unity-scope-gmusicbrowser unity-scope-gourmet unity-scope-colourlovers unity-scope-devhelp unity-scope-firefoxbookmarks unity-scope-chromiumbookmarks unity-scope-clementine unity-lens-friends unity-scope-audacious unity-scope-calculator account-plugin-aim account-plugin-jabber account-plugin-salut account-plugin-yahoo account-plugin-twitter account-plugin-windows-live account-plugin-flickr account-plugin-google account-plugin-facebook && \
sudo apt-get update && \
sudo apt-get dist-upgrade -y && \
sudo apt-get install -y zsh vim tmux git pass virtualbox gnome-tweak-tool rxvt-unicode xclip nodejs-legacy libxslt-dev libxml2-dev openssh-server
@alexblackie
alexblackie / backup.sh
Last active September 13, 2015 22:11
Super simple rsync-powered backup script
#!/bin/sh
# BLACKIEOPS SUPER LEGIT BACKUP SOLUTION (TM)
#
# - rsync's a few directories to a specified path (hopefully a remote NFS
# mount or something)
# - Keeps only the last two weeks of backups.
run () {
MOUNT=/backup/contents/$(hostname)
@alexblackie
alexblackie / keypush.sh
Last active October 4, 2015 11:08
Add SSH Key to server
cat ~/.ssh/id_rsa.pub | ssh user@host 'cat >> ~/.ssh/authorized_keys'
@alexblackie
alexblackie / linecount.sh
Created June 1, 2012 02:49
Count the lines of code in a PHP project (Unix-only) (Rough count)
wc -l `find . -iname "*.php"`
@alexblackie
alexblackie / index.html.slim
Created August 29, 2012 23:57
Colourful block menu - Preview: http://cl.ly/J6aG
nav.main-menu
a.nav-articles href="/" Articles
a.nav-portfolio href="/portfolio" Portfolio
a.nav-projects href="/projects" Projects
a.nav-speaking href="/speaking" Speaking
a.nav-about href="/about" About
a.nav-contact href="/contact" Contact
@alexblackie
alexblackie / xdg.sh
Created November 1, 2015 01:57
Set firefox as default browser on linux
# Set Firefox to be default browser on non-desktop-environmented Linux
xdg-mime default firefox.desktop 'x-scheme-handler/http'
xdg-mime default firefox.desktop 'x-scheme-handler/https'