Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Mike Fiedler miketheman

🏠
Working from home
View GitHub Profile
@miketheman
miketheman / gist:1370978
Created Nov 16, 2011
chef-datadog handler
View gist:1370978
$ vagrant provision
[default] Running provisioner: Vagrant::Provisioners::ChefSolo...
[default] Generating chef JSON and uploading...
[default] Running chef-solo...
[default] stdin: is not a tty
[default] [Wed, 16 Nov 2011 13:57:23 -0500] INFO: *** Chef 0.10.4 ***
[default] [Wed, 16 Nov 2011 13:57:23 -0500] DEBUG: Building node object for ubuntu-10.04.3-64
[Wed, 16 Nov 2011 13:57:23 -0500] DEBUG: Extracting run list from JSON attributes provided on command line
[Wed, 16 Nov 2011 13:57:23 -0500] INFO: Setting the run_list to ["recipe[chef_handler::datadog]", "recipe[dd-agent]", "recipe[nginx]"] from JSON
[Wed, 16 Nov 2011 13:57:23 -0500] DEBUG: Applying attributes from json file
@miketheman
miketheman / set_environment.rb
Created Dec 29, 2011 — forked from nstielau/set_environment.rb
A Knife plugin to set node environment
View set_environment.rb
## Knife plugin to set node environment
# See http://wiki.opscode.com/display/chef/Environments
#
## Install
# Place in .chef/plugins/knife/set_environment.rb
#
## Usage
# Nick-Stielaus-MacBook-Pro:chef-repo nstielau$ knife node set_environment mynode.net my_env
# Looking for mynode.net
# Setting environment to my_env
@miketheman
miketheman / default.rb
Created Jan 6, 2012
Chef: Handling older Amazon AMI instances running sysklogd instead of rsyslog
View default.rb
# In the rsyslog/recipe/default.rb, wrap the "package: command:
# We have to hack around yum dependency resolution since Amazon's Linux AMI is already using sysklogd
# and yum doesn't handle the swap out well enough
if platform?("amazon") && node['platform_version'] == "2010.11.2" # <== This is the version we are running.
# This was changed in version 2011.02, so any instances launched after that should be fine.
# No idea about other version numbers
cookbook_file "/tmp/yum-shell-rsyslog.yum" do
source "yum-shell-rsyslog.yum"
owner "root"
@miketheman
miketheman / example.rb
Created Jan 27, 2012
ruby - moved grep from string method to enumerable
View example.rb
ruby-1.8.7-p352 $ irb
1.8.7 :001 > thing = 'sometext'
=> "sometext"
1.8.7 :002 > thing.grep(/some/)
=> ["sometext"]
ruby-1.9.2-p290 $ irb
1.9.2p290 :001 > thing = 'sometext'
=> "sometext"
1.9.2p290 :002 > thing.grep(/some/)
@miketheman
miketheman / Vagrantfile
Created Feb 17, 2012 — forked from jean/Vagrantfile
Vagrantfile
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
#njj From http://devops.me/2011/10/10/vagrant-tricks-and-troubleshooting/
config.vm.customize ["modifyvm", :id, "--memory", "800"]
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
@miketheman
miketheman / gem_make.out
Created Mar 13, 2012
vagrant gem install veewee failure
View gem_make.out
/Applications/Vagrant/embedded/bin/ruby extconf.rb
checking for main() in -lc... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
@miketheman
miketheman / attributes_default.rb
Created Mar 29, 2012
CHEF-3010 repro cookbook/recipe
View attributes_default.rb
default['appdeploy']['dir'] = '/srv/myapp'
default['app']['dbname'] = 'testdb'
default['app']['dbuser'] = 'sa'
View incorrect permissions, deploy resource debug section
[Thu, 29 Mar 2012 14:46:01 +0000] DEBUG: Processing deploy[/srv/myapp] on localhost
[Thu, 29 Mar 2012 14:46:01 +0000] INFO: Processing deploy[/srv/myapp] action deploy (deployrepro::default line 57)
[Thu, 29 Mar 2012 14:46:01 +0000] INFO: deploy[/srv/myapp] set user to appdeploy
[Thu, 29 Mar 2012 14:46:01 +0000] INFO: deploy[/srv/myapp] set group to apache
[Thu, 29 Mar 2012 14:46:01 +0000] DEBUG: deploy[/srv/myapp] not creating /srv/myapp because it already exists
[Thu, 29 Mar 2012 14:46:01 +0000] DEBUG: deploy[/srv/myapp] not creating /srv/myapp/shared because it already exists
[Thu, 29 Mar 2012 14:46:01 +0000] DEBUG: deploy[/srv/myapp] finding current git revision
[Thu, 29 Mar 2012 14:46:01 +0000] DEBUG: sh(git rev-parse HEAD)
[Thu, 29 Mar 2012 14:46:01 +0000] DEBUG: deploy[/srv/myapp] finding current git revision
[Thu, 29 Mar 2012 14:46:01 +0000] DEBUG: sh(git rev-parse HEAD)
@miketheman
miketheman / security-group-cleanup.py
Created May 7, 2012
AWS EC2 Unused Security Group cleanup
View security-group-cleanup.py
#!/usr/bin/env python
import sys
import boto
import pprint
del_flag = ''
if len(sys.argv) > 1:
del_flag = sys.argv[1]
@miketheman
miketheman / penalties.rb
Created May 24, 2012
Rinxter penalties data study
View penalties.rb
# Tested with ruby 1.9.3, some issues in prior versions
# ruby magic
require 'json'
require 'net/http'
require 'pp'
# standards
@rx_ds_url = "http://rinxter.net/wftda/ds"
@rx_league = "GGRD"