Skip to content

Instantly share code, notes, and snippets.

Jill
Jack
Jim
Jane
Frank
Bob
Joe
Nancy
Alex
Somebody
@house9
house9 / pairs.rb
Last active August 29, 2015 13:56 — forked from lexun/pairs.rb
require 'ap'
$pair_size = (ENV['PAIR_SIZE'] || 2).to_i
def pairs(participants)
pairs = participants.shuffle.each_slice($pair_size).to_a
if pairs.last.size == 1
loner = pairs.pop
pairs.last << loner.first
host SOMEDOMAIN.COM
# where ns1.isp.com is one of your ISP DNS servers
nslookup SOMEDOMAIN.COM ns1.isp.com
dig SOMEDOMAIN.COM @ns1.isp.com
traceroute SOMEDOMAIN.COM
# on MAC flush dns cache
# given a file with a number on each line
# 1) add a comma to the end of each
q a # record and store in 'a'
A,<esc>j # Go to end of line in insert mode, type , go to next line
q # stop recording
50@a # run the recording 50 times
# 2) put all on a single line
:1,50j
@house9
house9 / Vagrantfile
Created June 12, 2013 01:22
Vagrantfile for postgres install via puppet
# 1) install puppet locally
# - install modules to local modules directory
# puppet module install puppetlabs/postgresql --force -i modules
# puppet module install puppetlabs/stdlib --force -i modules
# puppet module install puppetlabs/firewall --force -i modules
# puppet module install puppetlabs/apt --force -i modules
# puppet module install ripienaar/concat --force -i modules
# OR
# download tar file from https://forge.puppetlabs.com/puppetlabs/postgresql
# and place into modules directory
@house9
house9 / default.pp
Last active December 18, 2015 09:29
puppet manifest for postgres 9.2 on ubuntu
exec {
"apt-get update":
path => "/usr/bin"
}
# manage_package_repo => true will satisfy apt_postgresql_org
# include postgresql::package_source::apt_postgresql_org
class { 'postgresql':
version => '9.2',
@house9
house9 / Vagrantfile.multibox.chef.rb
Created June 1, 2013 15:38
Vagrantfile that sets up multiple boxes and loads chef configuration
Vagrant.configure("2") do |config|
# assumes your chef.json files are in cookbooks or site-cookbooks directory
servers = [
{
id: :db1,
ip: "172.16.2.111",
node_json: "master-db.json"
},
{
id: :db2,
@house9
house9 / chef-jenkins-postgres.rb
Created January 28, 2013 01:26
Add jenkins user to postgres as super user
execute "usermod jenkins -aG postgres" do
not_if "groups jenkins | grep postgres"
end
execute "createuser jenkins --superuser --no-password" do
user "postgres"
group "postgres"
cwd "/var/lib/postgresql"
not_if "psql postgres -tAc \"SELECT 1 FROM pg_roles WHERE rolname='jenkins'\" | grep 1",
class ExampleMailer < ActionMailer::Base
default from: "from@example.com"
# default layout for ExampleMailer
layout "customer_email"
# the order ready is sent to the customer and uses the default layout - customer_email
def order_ready
@greeting = "Hi"
mail to: "to@example.org"
end
mail.header['X-MSMail-Priority'].value.should == 'High'