Skip to content

Instantly share code, notes, and snippets.

git push -f #yolo

Tim Kennedy stretchkennedy

git push -f #yolo
View GitHub Profile
stretchkennedy / untested_routes.bash
Last active Dec 7, 2015
Horrible script to find untested routes based on a rails application and a log of tests
View untested_routes.bash
comm -23 <(rails r '{|r| "#{r.defaults[:controller].try(:camelize)}Controller##{r.defaults[:action]}"}.reject{|s| s == "Controller#"}.each{|s| puts s}' 2> /dev/null | sort | uniq) <(grep 'Processing by' log/test.log | sed 's/Processing by \(.*\) as .*/\1/' | sort | uniq)
stretchkennedy / Postgresql pg_upgrade on Ubuntu Trusty for pgsql 9.3 to 9.4
# Add postgresql repo and update apt listing
echo "deb trusty-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list > /dev/null
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install postgresql-9.4 -y
# Stop all running postgresql servers -- needed for migration of 9.3 data to 9.4 (pg_upgrade execution)
sudo /etc/init.d/postgresql stop
stretchkennedy / oryx-batch
Last active Sep 30, 2015
SysVinit startup scripts for Cloudera Oryx 2, assuming that it's installed in /usr/local/oryx and a user "oryx" has access to it
View oryx-batch
# Provides: oryx-batch
# Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Oryx 2 distributed lambda architecture - batch component
stretchkennedy / either.rb
Last active Aug 29, 2015
Create a class which will be equal to any of the passed-in arguments.
View either.rb
# USAGE: expect(some_object).to eq either(String, 5, { this: :hash }, @something_else)
def either *objs do
@objs = objs
def self.===(other)
@objs.reduce(false) do |memo, obj|
memo ||=
stretchkennedy / json_expression_helper.rb
Created Aug 25, 2014
For use with Allows you to write either(FooClass, BarClass). Useful if you're expecting nils.
View json_expression_helper.rb
module JsonExpressionHelper
def either *klasses do
@klasses = klasses
def self.===(other)
@klasses.reduce(false) { |memo, klass| memo ||= (other.class == klass) }
View paperclip_migration.rake
# First configure your models to use Amazon s3 as storage option and setup the associated S3 config.
# Then add the classes your want to migrate in the klasses array below.
# Then run rake paperclip_migration:migrate_to_s3
# Should work but this is untested and may need some tweaking - but it did the job for me.
namespace :paperclip do
desc "migrate files from local filesystem to s3"
task :migrate_to_s3 => :environment do
View init.el
; search path
(let ((default-directory "~/.emacs.d/"))
(require 'package)
(add-to-list 'package-archives
'("melpa" . "") t)
; save desktop
You can’t perform that action at this time.