Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
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(', ')}"
end
full_key_path = File.expand_path(key_path)
if File.exists?(full_key_path)
config.vm.provision 'file',
@BennettSmith
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/'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[1;34m\]"
NO_COLOUR="\[\033[0m\]"
View gist:876607

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

@BennettSmith
BennettSmith / gist:877892
Created Mar 19, 2011
Save dSYM files for iOS projects.
View gist:877892
STORAGEDIR=~/Development/dSYMStorage/
BUILDDATE=`date +%Y%m%d`
cd ${BUILT_PRODUCTS_DIR}
tar -czf ${STORAGEDIR}/${PRODUCT_NAME}-${BUILDDATE}.tbz ${PRODUCT_NAME}.app ${PRODUCT_NAME}.app.dSYM
@BennettSmith
BennettSmith / com.apple.syslogd.plist
Created Aug 9, 2011
Updated com.apple.syslogd.plist with network listener support added.
View com.apple.syslogd.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnableTransactions</key>
<true/>
<key>EnvironmentVariables</key>
<dict>
<key>ASL_DISABLE</key>
<string>1</string>
@BennettSmith
BennettSmith / .gitignore
Created Dec 10, 2011
Create a 1Hut Linux Template on Parallels
View .gitignore
.DS_Store
*.iso
@BennettSmith
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
BennettSmith / xcode4_build.py
Created Mar 25, 2012 — forked from dsibilly/xcode4_build.py
Unique Build Numbers for XCode 4
View xcode4_build.py
# XCode 4 auto-versioning script for Git
# Inspired by the work of Axel Andersson, Marcus S. Zarra and Matt Long
# http://valthonis.net/u/19
"""
NOTE: Due to its use of build environment variables, this
script will only work from inside XCode's build process!
"""
import os
@BennettSmith
BennettSmith / api.py
Created Apr 11, 2012
Tastypie Experiment
View api.py
# myapp/api.py
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
View copy-perms.sh
#!/bin/bash
# Create the script that emits values for a single file using stat.
cat >/tmp/fileperms.sh <<FILEPERMS
#!/bin/bash
echo chmod `stat -f '%Lp' \$1` \"\$1\"
echo chown `stat -f '%u' \$1`:`stat -f '%g' \$1` \"\$1\"
FILEPERMS
# Make sure the script is executable