Skip to content

Instantly share code, notes, and snippets.

@dcarley
dcarley / collect_elasticsearch.conf.erb
Created July 5, 2013 13:03
collectd configuration for querying Elasticsearch using curl_json plugin
<Plugin curl_json>
<URL "http://127.0.0.1:<%= es_port -%>/_cluster/nodes/_local/stats?http=true&process=true&jvm=true&transport=true">
Instance "elasticsearch"
<%
stats = {
"counter" => [
"indices.cache.field_evictions",
"indices.cache.filter_count",
"indices.cache.filter_evictions",
notice: Scope(Class[main]): Puppet version: 2.7.19
Must pass required to Class[Bar] at line 9 on node dcarley-mba.local
@dcarley
dcarley / anchor_pattern.png
Last active December 19, 2015 02:29
Puppet dependency patterns
anchor_pattern.png
@dcarley
dcarley / version.pp
Created June 25, 2013 08:12
PuppetMaster version
notice(inline_template('PuppetMaster version: <%= Puppet::PUPPETVERSION %>'))
@dcarley
dcarley / problem.sh
Last active December 18, 2015 22:19
Puppet 2.7.22 agent/master error
info: Retrieving plugin
err: /File[/var/lib/puppet/lib]: Failed to generate additional resources using 'eval_generate: Could not intern_multiple from yaml: Invalid option ftype for Puppet::FileServing::Metadata
err: /File[/var/lib/puppet/lib]: Could not evaluate: Could not intern from yaml: Invalid option ftype for Puppet::FileServing::Metadata Could not retrieve file metadata for puppet://puppet/plugins: Could
not intern from yaml: Invalid option ftype for Puppet::FileServing::Metadata
info: Loading facts in /var/lib/puppet/lib/facter/fqdn_underscore.rb
info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
info: Loading facts in /var/lib/puppet/lib/facter/iptables_persistent_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/ip6tables_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/iptables_version.rb
info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
@dcarley
dcarley / gist:5487768
Created April 30, 2013 09:58
Jenkins CORS
location /api/json {
proxy_pass http://localhost:8080;
add_header "Access-Control-Allow-Origin" "*";
add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS";
add_header "Access-Control-Allow-Headers" "origin, authorization, cookie, accept";
add_header "Access-Control-Allow-Credentials" "true";
}
@dcarley
dcarley / unicorn_test.py
Last active December 16, 2015 12:19
Test the effect of Unicorn's `check_client_connection` option on a queue of disconnected requests. For use with: https://github.com/nickstenning/timeouttest
"""
Test the effect of Unicorn's `check_client_connection` option on a queue of
disconnected requests. For use with:
https://github.com/nickstenning/timeouttest
"""
import sys
import time
import requests
@dcarley
dcarley / monitorama_stream_simple.html
Created March 28, 2013 12:49
Simple version of the Monitorama stream so that the window can be resized.
<html>
<body>
<div data-fastly-live="http://streamtest.fastly.com/hds-live/livepkgr/_definst_/monitorama/monitorama.f4m"></div>
<script async src="http://live.fastly.net/live.js"></script>
</body>
</html>
#!/bin/env ruby
require 'fileutils'
require 'pathname'
ARGV.each do |old_name|
match = old_name.match(/^(.+)\/([^\/]+_production)\/(.*?)_?(nginx|varnish)\/(.+\.wsp)$/)
next unless match
root, host, vhost, prog, wsp = match.captures
@dcarley
dcarley / vagrant-105
Created March 17, 2013 11:59
Vagrant 1.0 and 1.1 speed for Vagrantfile with 60 VMs.
dcarley-MBA:vagrant-govuk dcarley$ b vagrant --version
Vagrant version 1.0.5
dcarley-MBA:vagrant-govuk dcarley$ time b vagrant status >/dev/null
real 0m3.430s
user 0m3.528s
sys 0m1.172s