Skip to content

Instantly share code, notes, and snippets.

View blasterpal's full-sized avatar

Hank Beaver blasterpal

View GitHub Profile
@blasterpal
blasterpal / Chef-firewall-resource-errors.txt
Created October 28, 2011 19:37
Chef-firewall-resource-errors
Generated at 2011-10-28 19:27:20 +0000
NoMethodError: undefined method `firewall' for #<Chef::Recipe:0x00000004d64288>
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/mixin/recipe_definition_dsl_core.rb:56:in `method_missing'
/var/chef/cache/cookbooks/frodo/recipes/default.rb:28:in `from_file'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/mixin/from_file.rb:30:in `instance_eval'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/mixin/from_file.rb:30:in `from_file'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/cookbook_version.rb:578:in `load_recipe'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/mixin/language_include_recipe.rb:40:in `block in include_recipe'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/mixin/language_include_recipe.rb:27:in `each'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.4/lib/chef/mixin/language_include_recipe.rb:27:in `include_recipe'
@blasterpal
blasterpal / mixin_example.rb
Created November 8, 2011 00:57
My Mixin fun
class Content
#has all your junk
end
module ContentFooBar
def foobar
puts 'hello!'
end
end
@blasterpal
blasterpal / all_my_children.rb
Created November 16, 2011 19:05
Recursion of children
module ContentAllChildrenMethods
def all_my_children
kids = []
children.each do |child|
kids << child
kids << child.all_my_children
end
kids.flatten
end
end
@blasterpal
blasterpal / cinderella_tig_error.txt
Created December 1, 2011 15:31
Cinderella Tig Error
hef-stacktrace.out Generated at Thu Dec 01 10:11:15 -0500 2011
Chef::Exceptions::Exec: homebrew[tig] (homebrew::misc line 12) had an error: /Users/hankbeaver/Developer/bin/brew info tig | grep -q "Not installed"; if [ $? -eq 0 ]; then /usr/bin/env HOMEBREW_TEMP=/Users/hankbeaver/Developer/tmp /Users/hankbeaver/Developer/bin/brew install tig; fi returned 1, expected 0
/Library/Ruby/Gems/1.8/gems/chef-0.10.4/bin/../lib/chef/mixin/command.rb:185:in `handle_command_failures'
/Library/Ruby/Gems/1.8/gems/chef-0.10.4/bin/../lib/chef/mixin/command.rb:132:in `run_command'
/Library/Ruby/Gems/1.8/gems/chef-0.10.4/bin/../lib/chef/mixin/command.rb:200:in `run_command_with_systems_locale'
/Users/hankbeaver/.cinderella/cookbooks/homebrew/providers/homebrew.rb:33:in `run_brew_command'
/Users/hankbeaver/.cinderella/cookbooks/homebrew/providers/homebrew.rb:23:in `install_package'
/Library/Ruby/Gems/1.8/gems/chef-0.10.4/bin/../lib/chef/provider/package.rb:60:in `action_install'
/Library/Ruby/Gems/1.8/gems/chef-0.10.4/bin/../lib
@blasterpal
blasterpal / tmux_vim_clipboard_osx
Created February 6, 2012 18:21
Enable tmux + vim clipboard support in OSX
Resources:
http://rhnh.net/2011/08/20/vim-and-tmux-on-osx
https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
http://vim.wikia.com/wiki/Mac_OS_X_clipboard_sharing#Comments
1. Add mouse support in #1 blog.
2. Install the bin from #2 blog and follow directions. I use 'bash' so replace 'zsh' in config.
3. Add set clipboard=unnamed to vimrc/vimrc.local
@blasterpal
blasterpal / find_replace_mocha_stubs.txt
Created February 15, 2012 16:52
Find replace Mocha stubs with Rspec2 in vim
:args spec/*/*
:argdo %s/\(.*any_instance.*\)\(stubs\)\(.*\)\(returns\)\(.*\)/\1stub\3and_return\5/ge | update
@blasterpal
blasterpal / calc_mysql_db_size.txt
Created June 21, 2012 15:39
Calculate MySQL Database Size
SELECT table_schema "Data Base Name", SUM( data_length + index_length) / 1024 / 1024
"Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
@blasterpal
blasterpal / clear_resque_workers.rb
Created July 11, 2012 02:05
Clear all workers out of Resque
Resque.redis.smembers('workers').each {|k| Resque.redis.srem 'workers', k.to_s }
@blasterpal
blasterpal / clear_queue.rb
Created July 11, 2012 16:26
Resque snippits
Resque.redis.del 'queue:conversions'
Resque.redis.del 'queue:statistics'
#Clear all workers from Redis to ensure no worker creep
Resque.redis.smembers('workers').each{|w| Resque.redis.srem 'workers',w}
#Inspecting error types and histogram of counts:
failed_hash = (Resque.redis.lrange :failed, 1,473).collect{|ea| JSON.load ea};p nil
histogram = {}
failed_hash.each { |item| histogram[item["exception"]] = (histogram[item["exception"]] || 0) +1 };p nil
@blasterpal
blasterpal / ps.sh
Created July 19, 2012 15:10
PS Commands galore
#Forking view of ps
ps axjf
# inspect a single process
ps -p 20673 -F