Skip to content

Instantly share code, notes, and snippets.


Jonathan Owens intjonathan

View GitHub Profile
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
# Based on concept from puppetdb-external-naginator
# Generates nagios configs from puppet(db) exported resources.
intjonathan / gist:9281646
Created Feb 28, 2014
Expect script for sending passwords when upgrading puppet agent
View gist:9281646
set timeout 60
spawn ./ <fqdn> <fqdn> <fqdn>
while {1} {
expect {
eof {break}
"The authenticity of host" {send "yes\r"}
"password for YOURUSER:" {send "PASSWORD\r"}
#"*\]" {send "exit\r"}
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 / 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]
intjonathan / gist:a28f27022854cbb78866
Last active Aug 29, 2015
heka syslog with fallback
View gist:a28f27022854cbb78866
type = "MultiDecoder"
subs = ['WellFormedRyslogForwardFormatDecoder', 'BestGuessRyslogForwardFormatDecoder', 'SyslogParseFailureDecoder']
cascade_strategy = "first-wins"
type = "SandboxDecoder"
module_directory = "/usr/share/heka/lua_modules"
filename = "/usr/share/heka/lua_decoders/rsyslog.lua"
View usage example
>> puts `zip -h`
Copyright (c) 1990-2006 Info-ZIP - Type 'zip "-L"' for software license.
Zip 2.32 (June 19th 2006). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries in zipfile -m move into zipfile (delete files)
-r recurse into directories -j junk (don't record) directory names
View create_story_table.rb
class CreateStoryTable < ActiveRecord::Migration
def self.up
create_table :stories do |t|
t.string :title
t.integer :journal_id
t.integer :user_id
t.integer :account_id
View add_stories_count_to_journals.rb
class AddStoriesCountToJournals < ActiveRecord::Migration
def self.up
add_column :journals, :stories_count, :integer
def self.down
remove_column :journals, :stories_count
View gist:2589851
<title>[caution] - Memory &gt; 80%</title>
<pubDate>Mon, 30 Apr 2012 22:43:28 +0000</pubDate>
<title>[caution] - Memory &gt; 80%</title>
<pubDate>Sun, 29 Apr 2012 21:57:28 +0000</pubDate>
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";