Skip to content

Instantly share code, notes, and snippets.

View webframp's full-sized avatar

Sean Escriva webframp

View GitHub Profile
Chef::Log.info '** Patching deploy resource copy method to use rsync **'
class Chef::Provider::Deploy
def copy_cached_repo
FileUtils.mkdir_p(@new_resource.deploy_to + "/releases")
run_command(:command => "rsync -avC --exclude '.git*' #{::File.join(@new_resource.destination, ".")}/ #{release_path}")
Chef::Log.info "#{@new_resource} copied the cached checkout to #{release_path} using rsync"
release_created(release_path)
end
end
[Tue, 12 Jun 2012 21:23:08 +0000] DEBUG: NoMethodError: undefined method `[]' for nil:NilClass
/var/chef/cache/cookbooks/cloud/recipes/default.rb:43:in `block in from_file'
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/mixin/recipe_definition_dsl_core.rb:74:in `instance_eval'
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/mixin/recipe_definition_dsl_core.rb:74:in `method_missing'
/var/chef/cache/cookbooks/cloud/recipes/default.rb:40:in `from_file'
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/mixin/from_file.rb:30:in `instance_eval'
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/mixin/from_file.rb:30:in `from_file'
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/cookbook_version.rb:578:in `load_recipe'
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/mixin/language_include_recipe.rb:46:in `load_recipe'
/opt/opscode/embedded/lib/ruby/gems/1.9.1/gems/chef-0.10.10/lib/chef/mixin/lang
iptables -A INPUT -p tcp -s 184.106.28.0/24 -m hashlimit --hashlimit-above 20/day --hashlimit-name fubar -j DROP
user_keys = ""
search(:users, 'groups:sysadmin') do |u|
user_keys << u['ssh_keys']
end
file '/var/www/.ssh/authorized_keys' do
action :create
owner node[:nginx][:user]
mode 0400
@webframp
webframp / .tmux.conf
Created June 28, 2012 18:23
tmux config
# basic settings
#set -g default-terminal "screen-256color"
set -g default-terminal "xterm-256color"
setw -g xterm-keys on
set -g base-index 1
set -s escape-time 0
setw -g mode-mouse off
set -g default-command "reattach-to-user-namespace -l zsh"
# bindings
| Part | Brand | Description | Part-No | Price | url |
|-------------+-------------+----------------------------------------+-------------------+-------+------------------------------------------|
| Case | Thermaltake | V3 Black, No PS ATX | cas-the-020 | 46 | http://enuinc.com/cas-the-020.html |
| Power sup | Thermaltake | TR2-600 600w EPS | pow-the-600w | 61 | http://enuinc.com/pow-the-600w.html |
| CPU | Intel i3 | i3 2100 3.1GHz | cpu-1155-2100-i3 | 133 | http://enuinc.com/cpu-1155-2100-i3.html |
| Motherboard | Asus | P8H61-M LE | mb-1155-asu-018 | 75 | http://enuinc.com/mb-1155-asu-018.html |
| Memory | Crucial | 8g DDR3, matched pair | m-08g-133-c-k2-d3 | 52 | http://enuinc.com/m-08g-133-c-k2-d3.html |
| Harddrive | WD |
@webframp
webframp / org-outlook.el
Created September 7, 2012 13:56
Directly link to Outlook 2007 email from emacs org-mode
;;; org-outlook.el - Support for links to Outlook items in Org
;; via: http://superuser.com/questions/71786/can-i-create-a-link-to-a-specific-email-message-in-outlook
;;
;; use (require 'org-outlook) in init.el
(require 'org)
(org-add-link-type "outlook" 'org-outlook-open)
@webframp
webframp / copy_cached_repo.rb
Created November 2, 2012 18:12
copy_cached_repo.rb
Chef::Log.info '** Patching deploy resource copy method to use rsync **'
class Chef::Provider::Deploy
def copy_cached_repo
FileUtils.mkdir_p(@new_resource.deploy_to + "/releases")
run_command(:command => "rsync -a --exclude '.git*' #{::File.join(@new_resource.destination, ".")}/ #{release_path}")
Chef::Log.info "#{@new_resource} copied the cached checkout to #{release_path} using rsync"
release_created(release_path)
end
end
@webframp
webframp / copy_cached_repo.rb
Created November 2, 2012 18:41
copy_cached_repo.rb take two
Chef::Log.info '** Patching deploy resource copy method to use rsync **'
class Chef::Provider::Deploy
def copy_cached_repo
target_dir_path = @new_resource.deploy_to + "/releases"
if self.respond_to?(:converge_by)
converge_by("deploy from repo to #{@target_dir_path} ") do
copy_cached_repo_command_action(target_dir_path)
end
else
copy_cached_repo_command_action(target_dir_path)