Skip to content

Instantly share code, notes, and snippets.

View bhuber's full-sized avatar

Bennet Huber bhuber

  • compose.ai
  • Seattle, WA
View GitHub Profile
# 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
# Stolen from https://github.com/ghuntley/terminator-solarized/blob/master/config
[global_config]
title_transmit_bg_color = "#d30102"
focus = system
use_system_font = False
font = Inconsolata-dz 13
always_split_with_profile = True
[keybindings]
[profiles]
#[[default]]
@bhuber
bhuber / gist:5401882
Last active December 16, 2015 07:49
Bob the Bungler
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
bhuber / install_emacs.sh
Created October 28, 2012 21:05
Install emacs24 on ubuntu
#!/bin/sh
# adapted from https://launchpad.net/~cassou/+archive/emacs
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
@bhuber
bhuber / gist:3445093
Created August 24, 2012 03:17
pyler 26
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
bhuber / .gitconfig
Last active November 22, 2022 05:34
My git config, provides some nice shortcuts and features
# If you decide to use this, make sure you change name, email,
# and possibly editor first
# DO NOT COPY THIS SECTION INTO YOUR GITCONFIG
[user]
name = Bennet Huber
email = bennet@compose.ai
#Highlight whitespace in diffs
@bhuber
bhuber / gist:1712851
Created January 31, 2012 20:55
PhoneGap new browser window fix
/**
* 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:
@"http://platform.twitter.com/",
@bhuber
bhuber / camera.js
Created January 27, 2012 19:43
Phonegap Camera Function
var defaultPictureOptions = {
quality : 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA
/* ,
targetWidth: 100,
targetHeight: 100
*/
};