Skip to content

Instantly share code, notes, and snippets.

View nathwill's full-sized avatar
🐜
doin' stuff

Nathan Williams nathwill

🐜
doin' stuff
  • Treehouse
  • Portland, OR
View GitHub Profile
@nathwill
nathwill / gist:9054335
Created February 17, 2014 16:49
centos docker built routine
lang en_US.UTF-8
keyboard us
timezone --utc Etc/UTC
auth --useshadow --enablemd5
selinux --disabled
rootpw --lock --iscrypted locked
zerombr
clearpart --all --initlabel
@nathwill
nathwill / gist:8032248
Last active December 31, 2015 19:18
do crazy crazy shit with a backup file
#!/bin/bash
set -eu
# only run one instance
LOCKFILE=/tmp/pg_backup.lock
[ -f $LOCKFILE ] && { echo "Error: $LOCKFILE exists"; exit 1; } >&2
touch $LOCKFILE
@nathwill
nathwill / gist:6441103
Created September 4, 2013 18:46
OpenVZ CPU Calculations
#!/usr/bin/env ruby
require 'fileutils'
def get_freq
File.readlines('/proc/cpuinfo').each do |line|
next unless line.match(/^cpu MHz/)
return line.split(/:/).last.strip.to_f * 1048576
end
end
@nathwill
nathwill / Vagrantfile
Last active December 17, 2015 18:49
chef-solo multi-vm vagrantfile
# vm and role mapping for multi-vm vagrant
boxes = [
{ :name => :app, :roles => ['base', 'web'] },
{ :name => :mc, :roles => ['base', 'memcache'] },
{ :name => :db, :roles => ['base', 'db-master'] },
{ :name => :util, :roles => ['base', 'redis', 'resque' ] },
]
Vagrant.configure("2") do |config|
# base image configuration