Skip to content

Instantly share code, notes, and snippets.

@cburmeister
cburmeister / post-commit
Last active December 17, 2015 19:29
Simple git hook that snaps a photo every time a commit is made with http://iharder.sourceforge.net/current/macosx/imagesnap/
#!/usr/bin/env python
import os
import datetime
my_dir = os.path.expanduser('~/commit-captures')
if not os.path.exists(my_dir):
os.makedirs(my_dir)
filename = '%s/%s.jpeg' % (my_dir, datetime.datetime.now())
@cburmeister
cburmeister / freeleech.py
Created July 17, 2013 22:08
Grabs all freeleech torrents from what.cd in one go. Thanks @tobbez
#!/usr/bin/env python2
# encoding: utf-8
# freeleech_dl.py by tobbez
import json
import requests
import HTMLParser
import os
import re
from getpass import getpass
alphabet = [[chr(x), chr(x)] for x in range(65, 91)]
@cburmeister
cburmeister / bool_to_word.py
Created March 6, 2014 18:11
TIL Python's booleans are just integers
>>> bool_to_word = ['nope', 'yep']
>>> bool_to_word[True]
'yep'
>>> bool_to_word[False]
'nope'
>>> 5 * True
5
>>> 5 * False
0
@cburmeister
cburmeister / smtpd.py
Created April 28, 2014 23:37
Local python smtp debugging server
sudo python -m smtpd -n -c DebuggingServer localhost:25
@cburmeister
cburmeister / bootstrap.sh
Last active August 29, 2015 14:02
Quickly rebuild my OSX development environment.
#!/bin/bash
DOTFILES_DIR="$HOME/src/dotfiles"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew install git
mkdir src

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@cburmeister
cburmeister / gist:197488427f75014a2631
Created October 28, 2014 16:06
Increase ubuntu window size running in Virtualbox on OSX.
sudo apt-get install virtualbox-guest-dkms
@cburmeister
cburmeister / main.go
Last active August 29, 2015 14:14
Serve a directory over HTTP with go.
package main
import (
"net/http"
)
func main() {
fs := http.FileServer(http.Dir("static"))
http.Handle("/", fs)
http.ListenAndServe(":3000", nil)
@cburmeister
cburmeister / gitlab-docker.sh
Created February 17, 2015 08:27
Run GitLab with Docker in less than 5 minutes. https://github.com/sameersbn/docker-gitlab
#!/bin/bash
docker run --name='gitlab' -it --rm \
-e 'GITLAB_PORT=10080' -e 'GITLAB_SSH_PORT=10022' \
-p 10022:22 -p 10080:80 \
-v /var/run/docker.sock:/run/docker.sock \
-v $(which docker):/bin/docker \
sameersbn/gitlab:latest