Skip to content

Instantly share code, notes, and snippets.

View ryansch's full-sized avatar

Ryan Schlesinger ryansch

View GitHub Profile
@ryansch
ryansch / cli.rb
Last active December 15, 2015 09:39
Thor namespace with custom binary Fake gem name: example
# lib/example/cli.rb
module Example
class CLI < Thor
include Thor::Actions
include ExitCode
namespace :default
source_root Example.root_path
@ryansch
ryansch / .vimrc
Last active December 12, 2015 07:59
ctrlp configuration snippet
" Use tabs by default
let g:ctrlp_open_new_file = 't'
let g:ctrlp_open_multi = '1t'
" Use git's knowledge of files
let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files']
@ryansch
ryansch / 0-readme.md
Created December 7, 2012 20:36 — forked from burke/0-readme.md
ruby-1.9.3-p327 cumulative performance patch for rbenv without gc patch

ruby-1.9.3-p327 cumulative performance patch for rbenv without gc patch

This installs a patched ruby 1.9.3-p327 with various performance improvements without a backported COW-friendly GC to make things happy on heroku, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@ryansch
ryansch / Guardfile-patch.rb
Created March 27, 2012 23:50
Guardfile monkeypatch adding rspec style focus tags to cucumber
# Add focus support to cucumber
require 'guard/cucumber'
::Guard::Cucumber::Runner.class_eval do
class << self
alias original_command cucumber_command
def cucumber_command(paths, options={})
command = original_command(paths, options)
has_focus = paths.any? &method(:has_focus?)
command += " --tags @focus:4" if has_focus
command
@ryansch
ryansch / rbenv-install-system-wide.sh
Created February 20, 2012 18:39
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@ryansch
ryansch / move_to_rds.rb
Created January 24, 2012 23:51 — forked from guenter/move_to_rds.rb
A quick and dirty script to move a database into Amazon RDS (or any other database). Can transfer part of the data beforehand.
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
@ryansch
ryansch / gist:1150529
Created August 17, 2011 00:35
git issue
A - B - C - F - G - H
\ /
D - E
I want A, B, C, F, G, H but not D and E.
Bluepill.define_process_condition(:running_time) do
def initialize(options = {})
@below = options[:below]
end
def run(pid)
started = `ps -p #{pid} -o command`.match(/since (\d+)/)[1].to_i
Time.now - Time.at(started)
rescue
0
require 'daemon_controller'
require 'socket'
REPO_DIR = '/path/to/repos'
WHITELIST = %w{hostthis}
LISTEN = '1.2.3.4'
PORT = '9418'
PID_FILE = 'git-daemon.pid'
LOG_FILE = 'git-daemon.log'
LOCK_FILE = "#{PID_FILE}.lock"
# .bashrc
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
if [ -f .bash_completion ]; then