Skip to content

Instantly share code, notes, and snippets.

View thogg4's full-sized avatar

Tim Hogg thogg4

  • Test Double
  • North Carolina
  • X @thogg4
View GitHub Profile
#!/bin/bash
# Install rbenv
# https://github.com/sstephenson/rbenv
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bash_profile
echo 'eval "$(rbenv init -)"' >> .bash_profile
input {
file {
type => "rails"
path => ["/docker/log/logstash_production.log"]
codec => json {
charset => "UTF-8"
}
}
rabbitmq {
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@thogg4
thogg4 / gist:2993475
Created June 26, 2012 05:16
method on the Array class exactly like map, and collect
class Array
def just_like_map
r = []
self.each do |a|
r << yield(a)
end
r
end
end
@thogg4
thogg4 / bootsync.sh
Last active October 8, 2015 15:44
bootsync.sh
#!/bin/sh
grep '\-\-dns' /var/lib/boot2docker/profile || {
echo 'EXTRA_ARGS="$EXTRA_ARGS --dns 192.168.99.100 --dns 8.8.8.8 --dns 8.8.4.4"' | sudo tee -a /var/lib/boot2docker/profile
}
echo -e "nameserver 8.8.8.8\nnameserver 8.8.4.4" | sudo tee /etc/resolv.conf
name=${PWD##*/}
if docker-machine ls | grep -q "^$name\s" ; then
echo 'machine found'
else
echo 'machine not found. creating...'
docker-machine create --driver virtualbox $name
docker-machine ssh $name "sudo curl -o /var/lib/boot2docker/bootsync.sh https://gist.githubusercontent.com/thogg4/81de781d4a21382d1c11/raw/9b342537b42e1b7c595a9e1e112c2a131322fb51/bootsync.sh"
docker-machine restart $name
fi
@thogg4
thogg4 / gist:4029943
Created November 7, 2012 07:07
vimrc
call pathogen#runtime_append_all_bundles()
set noswapfile
filetype plugin indent on
" Make Vim remember cursor position
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
endif
@thogg4
thogg4 / gist:4029948
Created November 7, 2012 07:08
update_bundles
#!/usr/bin/env ruby
git_bundles = [
"git://github.com/msanders/snipmate.vim.git",
"git://github.com/thogg4/only-primary-nerdtree.git",
"git://github.com/timcharper/textile.vim.git",
"git://github.com/tpope/vim-cucumber.git",
"git://github.com/tpope/vim-fugitive.git",
"git://github.com/tpope/vim-git.git",
@thogg4
thogg4 / gist:4035402
Created November 7, 2012 23:41
postgres setup
create role myapp with createdb login password 'myapp'; // 'login' is optional if you plan to use psql
// with newer versions of Rails, 'rake db:create:all' will create all the databases listed in config/database.yml
select * from pg_user; // verify user created
select * from pg_shadow; // sysid listed here
create database myapp_development owner myapp;
create database myapp_test owner myapp;
@thogg4
thogg4 / except_catcher
Created January 4, 2013 04:30
rack middleware to catch exceptions
module Rack
class ExceptCatcher
def initialize(app, mailer)
@app = app
@mailer = mailer
@ignore = [404]
@hash_blacklist = %w(rack.session.options)
end
def call(env)