Skip to content

Instantly share code, notes, and snippets.

View schlueter's full-sized avatar

Brandon Schlueter schlueter

  • United States of America
View GitHub Profile
@schlueter
schlueter / .xinitrc
Created February 19, 2017 22:36
My xinitrc
#!/bin/sh
# Set cursor
xsetroot -cursor_name left_ptr &
# Set background
xsetroot -solid black &
feh --bg-center background.png &
# Enable a second monitor if present
xrandr --output eDP1 --auto --output HDMI2 --auto --right-of eDP1 &
@schlueter
schlueter / .ratpoisonrc
Created February 19, 2017 21:25
The contents of my .ratpoisonrc. Unmaintained and unused.
escape C-p
bind Escape abort
bind u undo
bind b exec firefox
bind c slack
bind m spotify
set border 0
set barpadding 0 0 0 0
set padding 0 0 0 0
INFO global: Vagrant version: 1.8.1
INFO global: Ruby version: 2.2.3
INFO global: RubyGems version: 2.4.5.1
INFO global: VAGRANT_OLD_ENV_SSH_TTY="/dev/ttys000"
INFO global: VAGRANT_OLD_ENV_MAIL="/var/mail/vagrant"
INFO global: VAGRANT_OLD_ENV_PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/embedded"
INFO global: VAGRANT_OLD_ENV_SSH_CONNECTION="192.168.2.1 60992 192.168.2.133 22"
INFO global: VAGRANT_OLD_ENV_SSH_CLIENT="192.168.2.1 60992 22"
INFO global: VAGRANT_OLD_ENV_OLDPWD="/Users/vagrant"
@schlueter
schlueter / cleanup.sh
Last active November 9, 2015 19:07
Source cleanup on OS X
# Remove trailing whitespace
find . -not \( -name .git -prune \) -type f -print0 | LC_ALL=C xargs -0 sed -i '' -E "s/[[:blank:]]+$//"
# Add newline @ eof if missing
find . -type f -print0 | LC_ALL=C xargs -0 sed -i -e '$a\' file
@schlueter
schlueter / git one liners.sh
Last active September 8, 2015 15:24
Helpful git one liners
# When you want the original versions of files during a rebase
git status | awk '/(both added|both modified):/ {
sub(/(both added|both modified):/, ""); print $1
}' | xargs -n1 git checkout $(git show | awk ' /commit/ { print $2 }')
# When you don't want files added during a rebase
git status | awk '/added by them:/ {
sub(/added by them:/, ""); print $1
}' | xargs -n1 git rm
@schlueter
schlueter / gist:bb0d50df0e5e1a981c08
Created June 16, 2015 03:38
CLI progress output (for Bytes) when partial and total may be queried
import math
def update(partial, total):
measurement_heuristic = int(math.floor(math.log10(total)) - 1)/3
unit, divisor = {
0: ('B', 1),
1: ('kB', 1000),
2: ('MB', 1e6),
3: ('GB', 1e9),
4: ('TB', 1e12)
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@schlueter
schlueter / gist:af81bf0eb258379d1c49
Created April 15, 2015 14:50
pyenv python install os x
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install -v 3.4.3
@schlueter
schlueter / gist:50cf66775c8c0426b06e
Created April 2, 2015 20:01
Pyenv install OS X 10.10.2
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include -I$(brew --prefix openssl)/include" LDFLAGS="-L$(brew --prefix openssl)/lib" pyenv install 3.4.3
@schlueter
schlueter / osx_init.sh
Last active August 29, 2015 14:18
OS X Init
# Show hidden files
defaults write -g AppleShowAllFiles -bool true
killall Finder
# Hide desktop
defaults write com.apple.finder CreateDesktop false
killall Finder