Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / vagrantenv.rb
Created May 17, 2012 20:28
vagrant environment
Vagrant::Config.run do |config|
config.vm.provision :chef_client do |chef|
chef.environment = "staging"
end
end
@agoddard
agoddard / host_groups_to_knife.py
Created May 9, 2012 23:15
Converts Nagios hosts config to knife role from file commands.
#!/usr/bin/env python
def host_groups_to_knife(hosts_config, output_file="knife_commands.sh"):
"""Converts Nagios hosts config to knife role from file commands."""
file = open(hosts_config, 'r')
output = "#!/bin/bash\n"
for line in file:
@agoddard
agoddard / gist:2472717
Created April 23, 2012 17:58
rabbitphail
==> /var/log/rabbitmq/rabbit.log <==
==> /var/log/rabbitmq/rabbit.log.1 <==
=INFO REPORT==== 23-Apr-2012::19:54:16 ===
Memory limit set to 400MB.
=INFO REPORT==== 23-Apr-2012::19:54:16 ===
Rolling persister log to "/var/lib/rabbitmq/mnesia/rabbit/rabbit_persister.LOG.previous"
#
# Denali's No-Knead Miracle Bread
#
require 'cast_iron_dutch_oven' # sudo gem install dutch_oven --version 3.5 Quart --source KitchenwaresStore
require 'mixing_bowl'
require 'spatula'
desc "Step 1. To be performed at night"
task(:at_night) do
@agoddard
agoddard / chef-dns.rb
Created February 1, 2012 00:18
populating DNS A records
hosts = search(:node, "*:*")
domains = {}
hosts.each do |node|
unless node.domain.nil?
domains[node.domain.to_sym] = [] if domains[node.domain.to_sym].nil?
domains[node.domain.to_sym] << {node.fqdn => node.ipaddress}
end
end
@agoddard
agoddard / elasticsearch.yml
Created January 13, 2012 19:22
logstash indexer config
path.conf: /etc/elasticsearch
path.data: /var/db/elasticsearch
path.work: /tmp
path.logs: /var/log/elasticsearch
bootstrap.mlockall: true