Skip to content

Instantly share code, notes, and snippets.

Always learning!

Bennett Smith BennettSmith

Always learning!
  • San Francisco Bay Area, CA
View GitHub Profile
View key_authorization.rb
def authorize_key_for_root(config, *key_paths)
[*key_paths, nil].each do |key_path|
if key_path.nil?
fail "Public key not found at following paths: #{key_paths.join(', ')}"
full_key_path = File.expand_path(key_path)
if File.exists?(full_key_path)
config.vm.provision 'file',
BennettSmith / gist:876359
Created Mar 18, 2011
Insert in .bashrc to display RVM gemset and git branch in shell prompt.
View gist:876359
function parse_git_branch () {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
View gist:876607

Generating SSH Key: - ssh-keygen -t rsa -C "" - (save in a file like id_rsa-github) - ssh-add ~/.ssh/id_rsa-github Configuration: - git config --global "Bennett Smith" - git config --global "" - git config --global github.user idvlpsw - git config --global github.token e0e9e3498b7b2780b33eece4a46fb674 - git config --global --list

BennettSmith / gist:877892
Created Mar 19, 2011
Save dSYM files for iOS projects.
View gist:877892
BUILDDATE=`date +%Y%m%d`
BennettSmith /
Created Aug 9, 2011
Updated with network listener support added.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
BennettSmith / .gitignore
Created Dec 10, 2011
Create a 1Hut Linux Template on Parallels
View .gitignore
BennettSmith / NSObject+DumpClassInfo.h
Created Jan 14, 2012
Objective-C class category to print out names of all selectors on a class.
View NSObject+DumpClassInfo.h
// NSObject+DumpClassInfo.h
// DumpSelectors
// Created by Bennett Smith on 1/14/12.
// Copyright (c) 2012 iDevelopSoftware, Inc. All rights reserved.
#import <Foundation/Foundation.h>
BennettSmith /
Created Mar 25, 2012 — forked from dsibilly/
Unique Build Numbers for XCode 4
# XCode 4 auto-versioning script for Git
# Inspired by the work of Axel Andersson, Marcus S. Zarra and Matt Long
NOTE: Due to its use of build environment variables, this
script will only work from inside XCode's build process!
import os
BennettSmith /
Created Apr 11, 2012
Tastypie Experiment
# myapp/
from tastypie.authorization import Authorization
from tastypie.authentication import ApiKeyAuthentication
from django.core.urlresolvers import NoReverseMatch
from django.conf.urls.defaults import url
from django.http import HttpRequest
from tastypie.utils import trailing_slash
from django.contrib.auth.models import User
# Create the script that emits values for a single file using stat.
cat >/tmp/ <<FILEPERMS
echo chmod `stat -f '%Lp' \$1` \"\$1\"
echo chown `stat -f '%u' \$1`:`stat -f '%g' \$1` \"\$1\"
# Make sure the script is executable