Skip to content

Instantly share code, notes, and snippets.

@sbates
sbates / gist:3123875
Created July 16, 2012 17:23
Form letter response to recruiters

Dear Recruiter,

Thank you for contacting me. As you can see on my LinkedIn profile, I am not seeking a full time position at this time. While I would consider a FT position with a startup, I am not interested in working for a company with more than 100 people nor do I wish to relocate to San Francisco or the Bay Area suburbs.

If you are receiving this form letter, it's because your email to me contained one of the above conditions. While I appreciate that you reached out to me, I am not able to respond personally to all of the form recruiting letters I receive and so I hope this suffices.

Have a nice day and no I don't have any referrals for you either.

xoxo, me

@sbates
sbates / gist:4164435
Created November 28, 2012 20:57
rvm attributes?
override_attributes "rvm" => {
"user_default_ruby" => "ruby-1.9.3",
"rvmrc" => {
'rvm_project_rvmrc_default' => 1,
'rvm_gemset_create_on_use_flag' => 1,
'rvm_trust_rvmrcs_flag' => 1,
'rvm_install_on_use_flag' => 1,
'rvm_make_flags' => "-j 3"
},
"user_gems" => {

I started writing a blog post to describe a specific problem I'm trying to solve. The blog post evolved into a 700 word preamble of culture and organic growth situation that I'm working with right now at a client. I already want to do a presentation on that so I've shelved that and gone back to my original idea which was, just see if anyone else is dealing with this and how.

I have a dev team who needs to hand off several chef cookbooks, roles and databags to an operations team with instructions on how to build specific nodes. There are dependencies that are coded into the cookbooks appropriately with comments, metadata and includes, but I have also been trying to establish a way to make things self documenting for both handoffs like this and as a way to establish a CI pattern for cookbook collections.

@sbates
sbates / gist:4383417
Created December 26, 2012 22:03
I notice so many people forking and rewriting cookbooks mostly because of installation diffs and we keep a lot of stuff in Artifactory. I'd like to be able to write Chef::Provider::Package::Artifactory and insert my custom package line instead of re-writing the wheel.
package "foo" do
action :install
end
# but I'm wondering about
package "foo" do
action :install
provider node[:foo][:provider]
end
@sbates
sbates / error
Created December 28, 2012 22:37
getting a chef error right after starting converge
Generated at 2012-12-28 16:33:15 -0600
ArgumentError: You must have a string like resource_type[name]!
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.16.4/lib/chef/resource_collection.rb:205:in `find_resource_by_string'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.16.4/lib/chef/resource_collection.rb:139:in `block in find'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.16.4/lib/chef/resource_collection.rb:134:in `each'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.16.4/lib/chef/resource_collection.rb:134:in `find'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.16.4/lib/chef/resource.rb:61:in `fix_resource_reference'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.16.4/lib/chef/resource.rb:50:in `resolve_resource_reference'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.16.4/lib/chef/resource.rb:406:in `block in resolve_notification_references'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.16.4/lib/chef/resource.rb:406:in `each'
@sbates
sbates / gist:4404905
Last active December 10, 2015 07:58
Artifactory sha-256 plugin being used to avoid remote_file repeated downloads
[2012-12-29T00:11:15-06:00] INFO: Processing artifact[solr] action download_static (solr::install line 46)
[2012-12-29T00:11:16-06:00] DEBUG: checking sha256 checksum for solr:"bb4415d1170ac94aa6bf065627617232ee94099ba3570b5c6bb9ca7cff30dca8"
[2012-12-29T00:11:16-06:00] INFO: Processing remote_file[/var/chef/cache/solr-4.0.0.war] action create (dynamically defined)
[2012-12-29T00:11:16-06:00] DEBUG: remote_file[/var/chef/cache/solr-4.0.0.war] checking for changes
[2012-12-29T00:11:16-06:00] DEBUG: remote_file[/var/chef/cache/solr-4.0.0.war] checksum matches target checksum (bb4415d1170ac94aa6bf065627617232ee94099ba3570b5c6bb9ca7cff30dca8) - not updating
@sbates
sbates / cksum.rb
Last active December 10, 2015 08:19
using the artifactory plugin for generating sha256 checksums, I then wrote some provider code to figure it out on the fly. This keeps chef from having to download all the artifacts first and calculate their checksums; this really speeds up chef runs on slow network days and cuts down on the number of things downloading from our Artifactory server.
# Once we've made our custom calls to artifactory, we can use the built-in chef resource for remote_file to actually fetch the artifact
def download(remote_file_url)
# construct the filename and destination for remote file
remote_file_name = "#{new_resource.name}-#{new_resource.version}.#{new_resource.filetype}"
remote_file_destination = new_resource.artifact_target || ::File.join(Chef::Config[:file_cache_path], remote_file_name)
# construct the remote_file source
sha256_cksum = get_checksum(remote_file_url, "sha256")
Chef::Log.debug("checking sha256 checksum for #{new_resource.name}:#{sha256_cksum.inspect}")
# wrapper overrides
# override attributes are being set here in order to use the base solr cookbook without direct modification
override[:solr][:home] = "/opt/solr/solr-home"
override[:solr][:configxml][:destdir] = "/opt/solr/solr-home/products/conf"
override[:solr][:configxml][:cookbook_loc] = "projectX"
[centos-6.3] Waiting for VM to boot. This can take a few minutes.
/Users/a766618/.rvm/gems/ruby-1.9.3-p327/gems/vagrant-1.0.5/lib/vagrant/action/vm/boot.rb:41:in `block in wait_for_boot': The VM failed to remain in the "running" state while attempting to boot. (Vagrant::Errors::VMFailedToRun)
This is normally caused by a misconfiguration or host system incompatibilities.
Please open the VirtualBox GUI and attempt to boot the virtual machine
manually to get a more informative error message.
from /Users/a766618/.rvm/gems/ruby-1.9.3-p327/gems/vagrant-1.0.5/lib/vagrant/action/vm/boot.rb:28:in `times'
from /Users/a766618/.rvm/gems/ruby-1.9.3-p327/gems/vagrant-1.0.5/lib/vagrant/action/vm/boot.rb:28:in `wait_for_boot'
def chef_block(arr) def chef_block(arr)
arr << %{ c.vm.provision :chef_solo do |chef|} arr << %{ c.vm.provision :chef_solo do |chef|}
arr << %{ chef.log_level = #{vagrant_logger_level} arr << %{ chef.log_level = #{vagrant_logger_level}
> arr << %{ chef.cookbooks_path = "/Users/sascha/cli
arr << %{ chef.run_list = #{instance.run_list.insp arr << %{ chef.run_list = #{instance.run_list.insp
arr << %{ chef.json = #{instance.attributes.to_s}} arr << %{ chef.json = #{instance.attributes.to_s}}
if instance.suite.data_bags_path if instance.suite.data_bags_path
arr << %{ chef.data_bags_path = "#{instance.suit arr << %{ chef.data_bags_path = "#{instance.suit
end end