Skip to content

Instantly share code, notes, and snippets.

View jodell's full-sized avatar

Jeffrey ODell jodell

View GitHub Profile
eval `ssh-agent -s`
ssh-add .ssh/id_dsa
ssh -A -o StrictHostKeyChecking=no $DB_HOST "$CLONE_SCRIPT"
ssh-agent -k
@jodell
jodell / gist:3531931
Created August 30, 2012 16:09
True pwd
DIR="$( cd "$( dirname "$0" )" && pwd )"
gawk 'match($0, /CREATE (TABLE|SEQUENCE|UNIQUE INDEX) (\w+)/, a) { print a[2] }' db/structure.sql > structures.out
# sanity heroku_env
#
# FIXME: Need a better way to 'prime' the app before doing a sanity check.
# When done, 503 should be removed from the set of valid http codes.
#
sanity() {
echo "Checking http://$1.herokuapp.com"
curl -s -S -L http://$1.herokuapp.com -o /dev/null -m 500 --retry 5 --retry-delay 8 -w '%{http_code}' \
| tee -a /tmp/heroku.out | grep -q '200\|401\|400\|503' || (echo "$1 deploy may have failed!" && exit 1)
}
awk -F= '/DISTRIB_CODENAME/{ print $2 }' /etc/lsb-release
@jodell
jodell / gist:3178454
Created July 25, 2012 20:27
PG cache hit ratio
-- https://devcenter.heroku.com/articles/cache-size
-- Cache hit ratio for PG Tables
SELECT
sum(heap_blks_read) as heap_read,
sum(heap_blks_hit) as heap_hit,
(sum(heap_blks_hit) - sum(heap_blks_read)) / sum(heap_blks_hit) as ratio
FROM
pg_statio_user_tables;
@jodell
jodell / crop.sh
Created June 22, 2012 04:20
crop launch image status bars
convert Default.png -crop 320x460+0+20 Default.png
convert Default\@2x.png -crop 640x920+0+40 Default\@2x.png
@jodell
jodell / gist:2968073
Created June 21, 2012 19:45
pad left
// Set field images, pad left input border.
self.usernameTextField.borderStyle = UITextBorderStyleNone;
self.usernameTextField.background = [UIImage imageNamed:@"text-input.png"];
UIView *usernamePaddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 20)];
self.usernameTextField.leftView = usernamePaddingView;
self.usernameTextField.leftViewMode = UITextFieldViewModeAlways;
@jodell
jodell / chef-ci.sh
Created June 19, 2012 22:00
Simple CI script for a Chef repo/server
#!/bin/bash
# This script provides a continuous devops loop between cookbook authoring,
# deployment to a chef-server, and verification of successful chef runs.
# Bootstrapping
bundle check || bundle --deployment --path=/var/lib/jenkins/shared/vendor_bundle
# Upload chef cookbooks & roles to the chef-server.
bundle exec rake upload:all
@jodell
jodell / gist:2854824
Created June 1, 2012 20:04
CLI XCode
#!/bin/bash
# Make sure TEST_AFTER_BUILD is set to true
xcodebuild -target myTests -configuration Debug -sdk iphonesimulator5.1 clean build