Skip to content

Instantly share code, notes, and snippets.

Avatar

Sean Escriva webframp

View GitHub Profile
View gist:1394221
#RVM
[[ -s "/Users/sme/.rvm/scripts/rvm" ]] && source "/Users/sme/.rvm/scripts/rvm" # load RVM into a shell session.
# ALIASES
alias l='ls -F -h'
alias ll='ls -l -F -h'
alias la='ls -a -F -h'
alias lla='ls -l -a -F -h'
# command equivalents
View users.rb
execute "create-tunnelblick-#{u['id']}" do
cwd node["openvpn"]["key_dir"]
command <<-EOH
mkdir #{u['id']}.tblk; cp ca.crt #{u['id']}.{crt,key,conf,ovpn} #{u['id']}.tblk
EOH
not_if { ::File.directory?("#{u['id']}.tblk") }
end
@webframp
webframp / reposplit.sh
Created Dec 15, 2011
Bash script to split multi-cookbook repo into individual git repos, retaining history, and uploads to github
View reposplit.sh
#!/bin/bash
for cookbook_dir in `ls community-cookbooks`; do
if [ $cookbook_dir != 'readme.md' ]; then
REPO=chef-$cookbook_dir
git clone --no-hardlinks ./community-cookbooks/ $REPO
SAVEDIR=`pwd`
cd $REPO
git filter-branch --subdirectory-filter $cookbook_dir HEAD -- --all --prune-empty
git reset --hard
@webframp
webframp / librato.rb
Created Jan 10, 2012
chef recipe for librato collectd plugin
View librato.rb
#
# Cookbook Name:: collectd_plugins
# Recipe:: librato
#
# Copyright 2012, Sean Escriva <sean.escriva@gmail.com>
#
case node.platform
when "ubuntu", "debian"
package "libpython2.7"
@webframp
webframp / collectd_server.rb
Created Jan 11, 2012
nifty chef run_list via map
View collectd_server.rb
name "collectd_server"
description "collectd server role"
run_list [ "recipe[collectd::server]" ].
concat( %w{ syslog librato cpu df disk interface memory swap }.map do |plugin|
"recipe[collectd_plugins::#{plugin}]"
end )
View *scratch*
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/amqp-0.7.4/lib/amqp/channel.rb:833:in `send': The channel 1 was closed, you can't use it anymore! (AMQP::ChannelClosedError)
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/amqp-0.7.4/lib/amqp/channel.rb:826:in `each'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/amqp-0.7.4/lib/amqp/channel.rb:826:in `send'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/amqp-0.7.4/lib/amqp/channel.rb:825:in `synchronize'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/amqp-0.7.4/lib/amqp/channel.rb:825:in `send'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/eventmachine-1.0.0.beta.4/lib/em/deferrable.rb:48:in `call'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/eventmachine-1.0.0.beta.4/lib/em/deferrable.rb:48:in `callback'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/amqp-0.7.4/lib/amqp/channel.rb:824:in `send'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/amqp-0.7.4/lib/amqp/queue.rb:195:in `delete'
from /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/eventmachine-
View gist:1936297
3 1 Building Abstractions with Procedures
4 ***************************************
5
6 The acts of the mind, wherein it exerts its power over simple
7 ideas, are chiefly these three: 1. Combining several simple ideas
8 into one compound one, and thus all complex ideas are made. 2.
9 The second is bringing two ideas, whether simple or complex,
10 together, and setting them by one another so as to take a view of
11 them at once, without uniting them into one, by which it gets all
12 its ideas of relations. 3. The third is separating them from all
View default.rb
package "collectd" do
package_name value_for_platform( ["centos", "redhat", "suse", "fedora"] => {
"default" => "collectd" },
["ubuntu", "debian"] => {
"default" => "collectd-core" } )
end
View awk-cookbook-versions.sh
knife cookbook list | awk '{print "\""$1"\" => \"= "$2"\","}'
View gist:2210484
(setq
backup-by-copying t
backup-directory-alist
'(("." . "~/.saves"))
delete-old-versions t
kept-new-versions 5
kept-old-version 2
version-control t)