Skip to content

Instantly share code, notes, and snippets.

View grepory's full-sized avatar
😃

Greg Poirier grepory

😃
  • SolarWinds
  • Atlanta, GA
View GitHub Profile
### Keybase proof
I hereby claim:
* I am grepory on github.
* I am grepory (https://keybase.io/grepory) on keybase.
* I have a public key whose fingerprint is 18E5 DF6A 251A BB85 2482 7990 F272 9497 27A5 2E46
To claim this, I am signing this object:
@grepory
grepory / example1.json
Last active August 29, 2015 14:00
Options for multi-datacenter sensu-dashboard
{
"api": {
"dc1": {
"host": "server.dc1"
},
"dc2": {
"host": "server.dc2"
}
}
}
@grepory
grepory / split.bash
Last active August 29, 2015 14:01
Literally the worst thing ever.
__split () {
local arr=$1
local new_ifs=$2
if [ -z $arr ]; then
echo "__split must be called with at least one argument" && exit 1
fi
if [ ! -z $new_ifs ]; then
IFS="$new_ifs" read -ra $arr
We're talking about service orchestration, and that is a thing that is
near and dear to my heart. I'd like to introduce you to the semaphore primitive
that I want to add to Chef, some chef pseudocode for you and an explanation of
how I envision it operating:
current_services = node.current_services
services = get_services(node.fqdn)
services.each do |svc|
service_data = get_service_data(svc, node.environment)
semaphore_acquire "deploy/#{svc}/#{node.environment}" do
** Reason for termination ==
** {{case_clause,
{{{value,
{15825,
{publish,<0.1876.1333>,
{message_properties,undefined,false},
{basic_message,
{resource,<<"/outbound-dev-rabbitmq">>,exchange,
<<"outbound.generation.exchange">>},
[<<"outbound.generation.4bcc31a4-557b-46dd-86a5-efbaecc77f7b.EMAIL">>],
@grepory
grepory / canary.rb
Last active August 29, 2015 14:02
Service deployments at Opower
deploy 'myservice' do
only_if { get_lock('myservice_counter_lock').got_lock? }
notify 'ruby_block[increment_myserver_counter]'
end
ruby_block 'increment_myservice_counter' do
action :nothing # this is so that it is only run on notify
block do
get_counter('myservice_counter').increment
end
@grepory
grepory / ceph_osd_bench_results.rb
Created June 18, 2014 18:50
Simple script to get useful information out of the ceph osd bench command.
#!/usr/bin/env ruby
require 'yaml'
results_file = ARGV[-1]
results = YAML.load_file(results_file)
blocksize = results.first.last['blocksize']
bytes_written = results.first.last['bytes_written']
avg_bytes_per_sec = results.map { |r| Float(r.last['bytes_per_sec']) }.reduce(:+) / results.length
require 'dns_test/resolver'
require 'support/using_dns_server'
shared_examples :zone_transfer do |nameserver, zone, operator, quantity|
subject { described_class.new(nameserver).transfer(zone) }
it 'returns Dnsruby::RRs' do
expect(subject).to satisfy { |rr| be_a_kind_of(Dnsruby::RR) }
end
it "returns #{rr_quantity_comparison} Dnsruby::RRs" do
expect(subject.length).to be.send(operator, quantity)
@grepory
grepory / gist:c11ff14653ac91d6e0cb
Last active August 29, 2015 14:05
devops thought leaders...
There’s a passage I got memorized. The Devopsekial 25:17. “The path of the
righteous devop is beset on allsides by the inequities of the selfish and the
tyranny of evil sysadmins. Blessed is he who, in the name of composition and
reusability, shepherds the weak through the valley of the world's worst
CFEngine 2 code, for he is truly his brother’s keeper and the finder of lost
children. And I will strike down upon thee with great frameworks and furious
coding those who attempt to poison and destroy My brothers. And you will know I
am the Devop when I lay My automation upon you.”
Now… I been sayin’ that shit for years. And if you ever heard it, that meant
#!/usr/bin/env bash
usage() {
cat <<HERE
$0: Create a shared volume for use with docker and mount it.
Options:
-v VOLUME_PATH
-n VOLUME_NAME