Skip to content

Instantly share code, notes, and snippets.

View tjhanley's full-sized avatar
🏒

Thomas Hanley tjhanley

🏒
View GitHub Profile
From a9753966872890154599fb9a0eb22a3fbe697515 Mon Sep 17 00:00:00 2001
From: CORP\thanley <[email protected]>
Date: Wed, 14 Jan 2009 13:38:49 -0800
Subject: [PATCH] Documented MasterDatabase inheritance for Models for Passenger.
---
README.markdown | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/README.markdown b/README.markdown
@tjhanley
tjhanley / xcodeversionr.sh
Created February 23, 2011 21:55
command line utility to write the version number and the git commit hash to your projects Bundle Version Id
#!/usr/bin/env bash
# place this in your path somewhere
# usage xcodeversionr.sh 1.0.1 MyProject-Info.plist
echo "Version: $1"
echo "File: $2"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $1 (build `git rev-parse --short HEAD`)" $2
@tjhanley
tjhanley / ETag and Deflate Settings
Created March 10, 2011 19:01
Here are my goto settings for Apache Etags and Deflate filter
# etag configuration:
FileETag MTime Size
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \
\.(?:exe|t?gz|zip|bz2|sit|rar)$ \
no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
@tjhanley
tjhanley / ExecuteBash.sh
Created September 20, 2011 05:03
Jenkins Rails RVM deployment setup
#!/bin/bash -x
source ~/.bash_profile
rvm use ree@appgemset
bundle install
bundle exec rake db:migrate
bundle exec rake spec
cap deploy
@tjhanley
tjhanley / cap_rubber_user_manage.rb
Created September 22, 2011 16:38
Rubber Capistrano Task to create/delete users across your cluster.
# This will create a user with a default password of #{username}123
# then the first time they connect they are prompted to change their password
# once the user is created in your local ./tmp directory you'll have the
# private and public keys for the new user
desc "Create a user on the servers"
require "cocaine"
task :create_server_user do
set(:user_to_add, Capistrano::CLI.ui.ask("USERNAME you'd like to add: ") )
@tjhanley
tjhanley / rubber_cname.rb
Created October 10, 2011 02:22
Rubber Capistrano Task to create CNAME records for app hosts
# uses route53 gem https://github.com/pcorliss/ruby_route_53
namespace :rubber do
desc "Setup Route53 for hosts"
task :setup_route53 do
require 'route53'
conn = Route53::Connection.new("ACCESS_KEY","SECRET_ACCESS_KEY")
#List Operations
zones = conn.get_zones #Requests list of all zones for this account
records = zones.first.get_records #Gets list of all records for a specific zone
@tjhanley
tjhanley / deploy.rb
Created November 5, 2011 21:47
Capistrano task for creating a change log file
desc "Create about and revision files."
task :rev_deployment, :roles => [:app, :web] do
require 'grit'
require 'chronic'
# include Grit
work_dir = File.join(File.dirname(__FILE__), '../../')
g = Grit::Repo.new(work_dir)
since = Chronic.parse('last week friday')
msg = "\n"
rev_file = File.join(File.dirname(__FILE__), '../../','tmp/revision.txt')
@tjhanley
tjhanley / deploy-node.rb
Created February 2, 2012 00:00
Rubber Capistrano Task to bootstrap Node.js on a server
namespace :rubber do
after "rubber:upgrade_packages", "rubber:prep_for_bootstrap"
desc "prep server for node install"
task :prep_for_bootstrap, :roles => 'node-js' do
rsudo "apt-get install python-software-properties"
rsudo "add-apt-repository ppa:chris-lea/node.js"
rsudo "apt-get update"
rsudo "apt-get -y install nodejs"
end
end
@tjhanley
tjhanley / bashkeyboardhelp
Created September 30, 2012 17:33
Bash Keyboard Shortcut Helper
BASH_KEYS=$(cat <<EOF
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + L Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H Same as backspace
Ctrl + R Let’s you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
@tjhanley
tjhanley / instaslurp.rb
Created December 19, 2012 06:13
instagram slurp. Working on a script to get all of your instagram pictures.
require 'rubygems'
require 'httparty'
require 'hashie'
require 'yaml'
YAML::ENGINE.yamler = 'syck'
YOUR_ACCESS_TOKEN = 'something'
url = 'https://api.instagram.com/v1/users/self/media/recent/?access_token=#{YOUR_ACCESS_TOKEN}&count=300'