Skip to content

Instantly share code, notes, and snippets.

@ryane
ryane / focus.rb
Created January 23, 2012 19:37
(un)Block distracting sites in hosts file via quick and dirty script. Inspired by http://al3x.net/2009/09/14/my-get-back-to-work-hack.html
#!/usr/bin/env ruby
## you will probably need to run this via sudo
## sudo ruby focus.rb [on|off]
# inspired by http://al3x.net/2009/09/14/my-get-back-to-work-hack.html
require 'fileutils'
require 'tempfile'
@ryane
ryane / gist:1877545
Created February 21, 2012 17:26
Rake task to restore the latest backup from heroku into your local development postgres database
# quick and dirty postgres database restoration from heroku
# This works in my local dev environment
# It might not work in yours without some changes
# Now just uses Heroku::Auth to get an authenticated client. No
# need to read a credentials file. You probably need a recent
# version of the heroku gem for this to work
desc "Restore from heroku"
task :restore do
require 'pgbackups/client'
@ryane
ryane / vimrc
Created October 30, 2012 20:29
my current vimrc ( 2012-10-30 )
set nocompatible " Must come first because it changes other options.
filetype off " required! (for vundle)
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let vundle manage vundle
" required!
Bundle 'gmarik/vundle'
@ryane
ryane / gist:5322099
Created April 5, 2013 19:50
tmux.conf
# fix copy/paste
set-option -g default-shell /usr/local/bin/zsh
set-option -g default-command "reattach-to-user-namespace -l \"/usr/local/bin/zsh\""
bind-key 'P' run-shell "tmux set-buffer \"$(/usr/local/bin/pbpaste)\"; tmux paste-buffer"
bind-key 'Y' run-shell "tmux show-buffer | /usr/local/bin/pbcopy"
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
# look good
set -g default-terminal "screen-256color"
@ryane
ryane / gist:5346950
Created April 9, 2013 16:01
current vimrc (2013-04-09)
set nocompatible " Must come first because it changes other options.
filetype off " required! (for vundle)
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let vundle manage vundle
" required!
Bundle 'gmarik/vundle'
@ryane
ryane / ci_install.sh
Created April 17, 2013 19:38
A script (or just list of commands) to setup a jenkins server on Ubuntu 12.04 hosted at linode. Liberally borrowed from https://gist.github.com/whistler/3179919#file-jenkins_rails_ubuntu-sh
sudo aptitude -y install build-essential libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev
sudo apt-get -y install libxslt-dev libxml2-dev
sudo apt-get -y install libmysqlclient-dev ruby-dev
sudo apt-get -y install libcurl4-openssl-dev
sudo apt-get -y install imagemagick libmagickcore-dev libmagickwand-dev
sudo apt-get -y install libsqlite3-dev
sudo apt-get -y install libreadline-dev
sudo apt-get -y install git
sudo apt-get -y install libicu48
sudo apt-get -y install nodejs
@ryane
ryane / gist:5492658
Created April 30, 2013 23:17
Disable Chrome's terrible print dialog
defaults write com.google.Chrome DisablePrintPreview -boolean true
@ryane
ryane / gist:5605255
Created May 18, 2013 17:47
A pre-commit hook that forces specs to run if you are on the master branch
#!/bin/sh
if [ "$(git rev-parse --abbrev-ref HEAD)" == "master" ]
then
if [ -f FORCE_COMMIT ]
then
rm FORCE_COMMIT
exit 0
else
echo "Running specs since you are committing to master..."
[
{
"external_id":"12345qwert67890zxcvb",
"id":664,
"confirmation_number":"1234567890",
"state":"unauthorized",
"first_name":"Jane",
"last_name":"Doe",
"email":"support@checkmate.io",
"room_code": "STDK",
@ryane
ryane / five_minutes.yml
Created February 24, 2015 15:15
five_minutes.yml
---
- hosts: all
vars:
UBUNTU_COMMON_ROOT_PASSWORD: 'xxxxx'
UBUNTU_COMMON_DEPLOY_PASSWORD: 'xxxxx'
UBUNTU_COMMON_LOGWATCH_EMAIL: user@example.com
ubuntu_common_deploy_user_name: deploy
ubuntu_common_deploy_public_keys:
- ~/.ssh/id_rsa.pub