Skip to content

Instantly share code, notes, and snippets.

@agoddard
agoddard / patch.rb
Created January 20, 2013 03:20
using Log.fatal
if checksum == '7d2742255cf6d5b40ffad091b4f17f390619390e0cf0ad6c64cb5e6655a2f65e'
#file came from a package install, we gotta replace the file with a patched version
elsif checksum == 'dec8cb0448a046be98b6d7a57b57589fd25556d067a65f4ff9f7d2deb69a7b2e'
#file already patched, nothing to do
elsif checksum.nil?
#no file, nothing to do
else
Chef::Log.fatal("uh oh, what's this checksum? we should probably not replace the file until we know what's going on...")
end
@agoddard
agoddard / dump_tabs.applescript
Created March 8, 2013 03:31
Save URLs of all open safari tabs to TextEdit
tell application "Safari"
--Variables
set windowCount to number of windows
set docText to ""
--Repeat for Every Window
repeat with x from 1 to windowCount
set tabcount to number of tabs in window x
--Repeat for Every Tab in Current Window
repeat with y from 1 to tabcount
--Get Tab Name & URL
@agoddard
agoddard / bribe.md
Last active December 14, 2015 21:49
Ethically questionable opscode bribe

UPDATE!

Thanks to @coderanger for helping me out (so quickly). He was kind enough to say no to the gift, so on @opscode's behalf, I donated a green energy biogas stove for a family through Heifer (I guess the cow thing was a thing).

stove

If you want to donate one yourself - https://secure1.heifer.org/gift-catalog/stoves.html

The irony didn't escape me that the person who helped me has multiple usernames and I couldn't find @kantrn on github until I remembered the @coderanger thing ;)

@agoddard
agoddard / tab_warn.applescript
Created March 19, 2013 21:13
warns you when you have too many tabs open
property tCounter : 0
tell application "Google Chrome"
--Variables
set windowCount to number of windows
set docText to ""
--Repeat for Every Window
repeat with x from 1 to windowCount
set tabcount to number of tabs in window x
--Repeat for Every Tab in Current Window
@agoddard
agoddard / Vagrantfile
Last active December 15, 2015 14:08
sensu demo Vagrantfile
Vagrant::Config.run do |config|
config.vm.box = "sandbox"
config.vm.box_url = "http://repos.sensuapp.org/box/sandbox.box"
config.vm.forward_port 4567, 4567
config.vm.forward_port 8080, 8080
end
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
puts "Everything is fine, you have plenty of credits, things are just great."
puts "None of your checks are down, you don't even need to worry."
puts "Also, " + JSON.parse(open('http://irish-toast.herokuapp.com').read)['toast']
[root@testing-sensu01 ~]# /opt/sensu/embedded/bin/ruby campfire_test.rb
/opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:917:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (Faraday::Error::ConnectionFailed)
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:917:in `block in connect'
from /opt/sensu/embedded/lib/ruby/2.0.0/timeout.rb:51:in `timeout'
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:917:in `connect'
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:861:in `do_start'
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:850:in `start'
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:1366:in `request'
from /opt/sensu/embedded/lib/ruby/2.0.0/net/http.rb:1125:in `get'
from /opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:73:in `perform_request'
@agoddard
agoddard / dod_global_thoughts.md
Created September 8, 2013 19:49
DoD Global thoughts

DevOpsDays Global disccusion August '13

@geekle & @anthonygoddard (Melbourne represent yo.)

decentralization

We talked about the need to decentralize DoD as much as possible, with the aim of reducing dependence on Patrick for the small stuff, letting him concentrate on the Big Stuff™

But we need to stay true to what makes DoD awesome

herinlies the challenge. One idea we discussed was to follow the "TEDx" model, where independent organizers are given a time-limited 'license' to run a single event. The license is applied for online, approved by core-organizers who can run through a simple checklist (is the event name too ambiguous (devopsdays USA, devopsdays california, is the event scheduled too close to another geographically close event etc) and in applying for the license, the licensee has to agree to some simple terms (tickets must be available to the general public, videos must be recorded of the talks, tickets mustn't cost more than $x, no vendor talks etc). Licenses would be simple to renew,

@agoddard
agoddard / finding_data
Created October 14, 2013 17:23
AAAAARGH.
~ $ curl -I http://gdex.cr.usgs.gov/gdex/
HTTP/1.1 503 Service Unavailable
Connection: Close
Content-Type: text/html
~ $ curl -I http://www.add.scar.org
curl: (7) couldn't connect to host
~ $ curl -I https://lta.cr.usgs.gov/GTOPO30
curl: (35) error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112)
THREEDAYS = 60 * 60 * 24 * 3
files = ::Dir["/tmp/open-uri*"]
files.each do |agoddard|
file agoddard do
action :remove
only_if ( ::File.stat(agoddard).gid == 5001 && ::File.stat(agoddard).mtime.to_i >= THREEDAYS )
end
end