Skip to content

Instantly share code, notes, and snippets.

View snewman's full-sized avatar

Sam Newman snewman

View GitHub Profile
@snewman
snewman / gist:64a8c8e7d3345a3356a2
Created April 9, 2015 08:35
Middleman function to link to pages that exist, or print out that they need to be written
def pattern_link(pattern_name, link_name = nil)
pages = sitemap.resources.select{ | page | page.url.start_with?('/patterns/') and page.data.title == pattern_name}
if pages.empty?
puts "Need to write a pattern for " + pattern_name
return '<span class="pending_pattern">' + pattern_name + '</span>'
else
if pages.length > 1
puts "Warning: more than one pattern page for " + pattern_name
end
@snewman
snewman / ansible_fireball_setup
Created July 15, 2013 00:45
This got ansible's fireball mode working for me from a clean Ubuntu 12.04 AWS instance. The tricky thing is that you will also need these dependencies deployed locally too - otherwise you'll get errors about zmq not being deployed. Currently, Ansible doesn't say if the missing dependency is on the server or client, which caused me much angst!
---
- hosts: all
sudo: yes
user: ubuntu
gather_facts: no
connection: ssh
tasks:
- action: shell sudo aptitude update
- apt: name={{ item }} state=installed
with_items:
@snewman
snewman / gist:1933250
Created February 28, 2012 15:45
AWS Cloud Init
#!/bin/bash
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
wget http://bit.ly/aws-ec2id
nohup bash aws-ec2id &
@snewman
snewman / devbox-bootstrap.sh
Created August 22, 2011 15:08
Devbox bootstrap
#!/bin/bash
# Edit /etc/sysconfig/network to change the hostname - keep the 'lmuk.local ending
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
wget http://tmz.fedorapeople.org/repo/puppet/epel/puppet.repo -O /etc/yum.repos.d/puppet.repo
yum install -y puppet-2.6.6
yum install -y git
easy_install pycrypto==2.3
@snewman
snewman / Test Vagrant File
Created October 21, 2010 10:02
Used for getting rough timings of vagrant up on new boxes
Vagrant::Config.run do |config|
config.vm.box = "lucid32"
config.vm.provisioner = :chef_solo
config.chef.cookbooks_path = "cookbooks"
config.chef.add_recipe("vagrant_main")
config.vm.define :web1 do |web_config|
@snewman
snewman / Broken Two VM Vagrantfile
Created October 20, 2010 18:55
Get a * Base MAC address for eth0/NAT must be set. Contact box maintainer for more information. error
Vagrant::Config.run do |config|
config.vm.box = "lucid32"
config.vm.provisioner = :chef_solo
config.chef.cookbooks_path = "cookbooks"
config.chef.add_recipe("vagrant_main")
#config.vm.forward_port("web", 80, 4567)
(ns com.thoughtworks.loganalysis.loganalysis
(:use
midje.semi-sweet
incanter.core
incanter.charts
clojure.test
clojure.contrib.str-utils
[clojure.contrib.duck-streams :only (read-lines)])
(:import org.joda.time.format.DateTimeFormat))
(ns com.thoughtworks.loganalysis.loganalysis
(:use
midje.semi-sweet
incanter.core
incanter.charts
clojure.test
clojure.contrib.str-utils
[clojure.contrib.duck-streams :only (read-lines)])
(:import org.joda.time.format.DateTimeFormat))