Skip to content

Instantly share code, notes, and snippets.


Bennet Huber bhuber

  • Seattle, WA
View GitHub Profile
View .tmux.conf
# To reload:
# CTRL-b : source-file ~/.tmux.conf
set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ',*:enacs@:smacs@:rmacs@:acsc@'
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# I like to see far back into my past
set-option -g history-limit 20000
View terminator_config
# Stolen from
title_transmit_bg_color = "#d30102"
focus = system
use_system_font = False
font = Inconsolata-dz 13
always_split_with_profile = True
bhuber / gist:5401882
Last active Dec 16, 2015
Bob the Bungler
View gist:5401882
Our building is secured by locked doors with keypads. The keypads have 10 digits
on them (0 - 9) and require a 4-digit access code to unlock the doors.
Unfortunately, they were designed by Bob the Bungler, so rather than typing 4
digits and hitting "Enter", they simply wait for the right sequence of digits to
be pressed and then unlock. So for example if the code is "1234", and someone
enters "2938470871234" it will open on the last digit. What is the minimum
number of digits you have to enter to try all possible combinations?
Here's the answer. In order to avoid spoilers, I won't tell you how long it is.
bhuber /
Created Oct 28, 2012
Install emacs24 on ubuntu
# adapted from
sudo apt-get update
sudo apt-get install
sudo apt-get purge emacs-snapshot-common emacs-snapshot-bin-common emacs-snapshot emacs-snapshot-el emacs-snapshot-gtk emacs23 emacs23-bin-common emacs23-common emacs23-el emacs23-nox emacs23-lucid auctex emacs24 emacs24-bin-common emacs24-common emacs24-non-dfsg
#To add this PPA:
sudo add-apt-repository ppa:cassou/emacs
View gist:3445093
def repeat(n):
rems = [0] * n
rem = 1
num = rem
result = ''
while True:
num *= 10
rems[rem] = 1
quot = num / n
if quot > 0:
bhuber / .gitconfig
Last active Feb 7, 2022
My git config, provides some nice shortcuts and features
View .gitconfig
# If you decide to use this, make sure you change name, email,
# and possibly editor first
name = Bennet Huber
email =
#Highlight whitespace in diffs
bhuber / gist:1712851
Created Jan 31, 2012
PhoneGap new browser window fix
View gist:1712851
* Start Loading Request
* This is where most of the magic happens... We take the request(s) and process the response.
* From here we can re direct links and other protocalls to different internal methods.
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
//super hackish hack of the night, so the social networking stuff doesn't trigger another window to be opened.
NSArray *special = [NSArray arrayWithObjects:
bhuber / camera.js
Created Jan 27, 2012
Phonegap Camera Function
View camera.js
var defaultPictureOptions = {
quality : 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA
/* ,
targetWidth: 100,
targetHeight: 100