Skip to content

Instantly share code, notes, and snippets.

@zts
zts / gist:5040376
Created February 26, 2013 17:31
Injecting library methods into Chef Recipes and Resources. Stolen from http://pastie.org/6342636
module Extensions
def my_special_method
Chef::Log.info "HEY!"
end
end
[Chef::Recipe, Chef::Resource].each { |l| l.send :include, ::Extensions }
@zts
zts / gist:4338458
Created December 19, 2012 17:18
How to configure git to push all branches automatically. This helps make "knife cookbook site install" do the right thing more often.
git config --add remote.origin.push 'refs/heads/*:refs/heads/*'
git config --add remote.origin.push 'refs/tags/*:refs/tags/*'
git config --add remote.origin.fetch 'refs/heads/*:refs/remotes/origin/*'
git config --add remote.origin.fetch 'refs/tags/*:refs/tags/*'

Adrian -

I appreciate that you spent time in writing this post. I know I've been up until 2am writing similarly long ones as well. I will take responsibility for having what is likely an irrational response (I blame Twitter for that) to the term "NoOps", but I invite you to investigate why that might be. I'm certainly not the only one who feels this way, apparently, and thus far have decided this issue is easily the largest distraction in my field I've encountered in recent years. I have had the option to simply ignore my opposition to the term, and just let the chips fall where they may with how popular the term "NoOps" may or may not get. I have obviously not taken that option in the past, but I plan to in the future.

You're not an analyst saying "NoOps". Analysts are easy (for me) to ignore, because they're not practitioners. We have expectations of engineering maturity from practitioners in this field of web engineering, especially those we consider leaders. I don't have any expectations from analysts,

# cookbooks/chef_notifier/libraries/chef_notifier.rb
#
# This monkeypatches Chef::Runner to report the result of run_action calls via MCollective
require 'mcollective'
class MRPC
include MCollective::RPC
def report_action(resource, action)
options = MCollective::Util.default_options
@zts
zts / Inventory
Created August 20, 2011 22:10
Demo - ActiveMQ + MCollective in Vagrant, using chef-solo
vagrant@vagrant:~$ mco inventory vagrant
Inventory for vagrant:
Server Statistics:
Version: 1.3.0
Start Time: Sat Aug 20 21:54:23 +0000 2011
Config File: /etc/mcollective/server.cfg
Collectives: mcollective
Main Collective: mcollective
Process ID: 22575
@zts
zts / gist:1134003
Created August 9, 2011 13:11
Building ruby with readline support on OS X
( via http://twitter.com/patrickdebois/status/100915097177833472 )
brew install readline
rvm install 1.9.2 --with-readline-dir=/usr/local/Cellar/readline/6.2.1/
=> irb with CTRL-R reverse history search
@zts
zts / activemq-recipe-mcollective.rb
Created August 7, 2011 21:01
Installing and configuring ActiveMQ for MCollective (insecure configuration)
include_recipe "activemq::default"
version = node['activemq']['version']
activemq_home = "#{node['activemq']['home']}/apache-activemq-#{version}"
cookbook_file "#{activemq_home}/conf/activemq.xml" do
source "activemq.xml"
mode "0644"
owner "root"
group "root"
@zts
zts / gist:1064934
Created July 5, 2011 14:30 — forked from russss/gist:1064891
Git post-receive hook to post commit details to an AMQP topic
#!/usr/bin/env python
""" Git post-receive hook to publish commit data to an AMQP topic.
apt-get install python-git python-amqplib
or:
easy_install amqplib gitpython
"""
import os, sys, json
from datetime import datetime
from git import *
[zstevens@zts-mbp ~]$ time perl -e 'my $x; my $block = sub { $x=1; }; for (1..1000000) { &$block; };'
real 0m0.398s
user 0m0.386s
sys 0m0.006s
[zstevens@zts-mbp ~]$ time perl -e 'my $x; my $block = sub { $x=1;$x=1;$x=1;$x=1;$x=1;$x=1;$x=1;$x=1;$x=1;$x=1; }; for (1..100000) { &$block; };'
real 0m0.118s
user 0m0.108s