Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Owens intjonathan

View GitHub Profile
View FutureStack 2016 Links.md
@intjonathan
intjonathan / gist:a28f27022854cbb78866
Last active Aug 29, 2015
heka syslog with fallback
View gist:a28f27022854cbb78866
[rsyslog-with-fallback-decoder]
type = "MultiDecoder"
subs = ['WellFormedRyslogForwardFormatDecoder', 'BestGuessRyslogForwardFormatDecoder', 'SyslogParseFailureDecoder']
cascade_strategy = "first-wins"
[WellFormedRyslogForwardFormatDecoder]
type = "SandboxDecoder"
module_directory = "/usr/share/heka/lua_modules"
filename = "/usr/share/heka/lua_decoders/rsyslog.lua"
@intjonathan
intjonathan / mysql-passwords.rb
Created Apr 22, 2014
generate mysql passwords quickly
View mysql-passwords.rb
require 'keepass/password'
10.times do
password = KeePass::Password.generate('[Adbp]{20}', :remove_lookalikes => true);
p password
p `mysql -e 'select password("#{password}")\G'`.match(/\*(\w+)/)[1]
end
View rbenv-patch-format
diff -ur ext/openssl/ossl_pkey_ec.c ext/openssl/ossl_pkey_ec.c
--- ext/openssl/ossl_pkey_ec.c 2012-02-19 06:09:11.000000000 -0800
+++ source/ext/openssl/ossl_pkey_ec.c 2014-01-03 16:37:11.077561351 -0800
@@ -757,8 +757,10 @@
method = EC_GFp_mont_method();
} else if (id == s_GFp_nist) {
method = EC_GFp_nist_method();
+#if !defined(OPENSSL_NO_EC2M)
} else if (id == s_GF2m_simple) {
method = EC_GF2m_simple_method();
@intjonathan
intjonathan / gist:9281646
Created Feb 28, 2014
Expect script for sending passwords when upgrading puppet agent
View gist:9281646
set timeout 60
spawn ./upgrade_nodes_pe3.sh <fqdn> <fqdn> <fqdn>
while {1} {
expect {
eof {break}
"The authenticity of host" {send "yes\r"}
"password for YOURUSER:" {send "PASSWORD\r"}
#"*\]" {send "exit\r"}
}
@intjonathan
intjonathan / nagiosdb.rb
Last active Aug 29, 2015 — forked from jfryman/nagiosdb.rb
Update nagios configuration from puppetdb using stock puppet nagios_ resources.
View nagiosdb.rb
#!/usr/bin/env ruby
#
# Nagios/PuppetDB config generator
# https://gist.github.com/jfryman/6290985
#
# Based on concept from puppetdb-external-naginator
# https://github.com/favoretti/puppetdb-external-naginator
#
# Generates nagios configs from puppet(db) exported resources.
#
@intjonathan
intjonathan / upgrade-nodes-pe3.sh
Created Dec 3, 2013
Pass a list of FQDNs and it'll nuke PE2 and install PE3.1
View upgrade-nodes-pe3.sh
#!/bin/bash
for host in "$@"; do
echo "Doing $host"
ssh -tt "${host}" 'curl https://gist.github.com/intjonathan/7663914/raw/17e2638f5db32db2c2d8d7dea80c4c1f8ac09847/pe-3-agent-upgrade.sh | bash'
ssh -tt chi-ops-provision-1 "sudo puppet node deactivate ${host}; sudo puppet cert clean ${host}"
done
View pe-3-agent-upgrade.sh
#!/bin/bash
pushd .
cd /tmp/
# Remove PE 2.6.1
curl -o /tmp/pe26.tar.gz "http://chi-boss.newrelic.com/pe-installer/puppet-enterprise-2.6.1-el-6-x86_64.tar.gz"
tar xzf /tmp/pe26.tar.gz
sudo /tmp/puppet-enterprise-2.6.1-el-6-x86_64/puppet-enterprise-uninstaller -p -y
@intjonathan
intjonathan / gist:7254263
Last active Dec 27, 2015
puppetdb with newer postgres
View gist:7254263
class { "postgresql::globals":
version => '9.3',
manage_package_repo => true,
}
# This installs postgres for you
class { '::puppetdb':
database_password => hiera('profile::puppetdb::pg_puppetdb_password'),
java_args => {'-Xmx' => '2g', '-Xms' => '2g'},
}
@intjonathan
intjonathan / pagerduty-ring-through.js
Created Sep 8, 2012
on{x} recipe to make pagerduty texts always play ringtone, then play annoying sound every minute until unlocked
View pagerduty-ring-through.js
// =====================================================================
// Crank up the volume and play an annoying sound every minute when you
// get a text from PagerDuty. Put things back when you unlock the screen.
// @intjonathan
// =====================================================================
var strVersion = 'v0.3';
var lngInterval = 1*60*1000; // 1 minute
var strAlarmFilePath = "file:///mnt/sdcard/Music/Ringer.mp3";
You can’t perform that action at this time.