Skip to content

Instantly share code, notes, and snippets.

... other stuff that works ...
if node['notifications']['disabled']
Chef::Log.debug('Notifications are disabled on this node.')
return
else
file '/var/lock/subsys/notification' do
owner 'root'
group 'root'
mode '0755'
@maewolfsky
maewolfsky / bashrc-changes.md
Last active August 29, 2015 14:23
Show your current git branch in your prompt

Description

I find it helpful to be able to see what branch you have checked out when inside a git repo. Just make the following additions to your .bashrc (or any other file that gets sourced on shell creation).

.bashrc

function parse_git_remote_origin {
  git config --get remote.origin.url | sed -Ee "s/^(https:\/\/|git@|ssh:\/\/git@)?([^:\/@]+)[\/:].*(\.git)?$/\2/"
}
@maewolfsky
maewolfsky / Vagrant output
Created May 5, 2014 14:12
Vagrant 1.5.4 and vagrant-berkshelf 2.0.1 problems
$ v up
Vagrant failed to initialize at a very early stage:
The plugins failed to load properly. The error message given is
shown below.
Could not open library '/Users/mbaxa/.vagrant.d/gems/gems/dep_selector-1.0.3/lib/dep_gecode.bundle': dlopen(/Users/mbaxa/.vagrant.d/gems/gems/dep_selector-1.0.3/lib/dep_gecode.bundle, 5): Symbol not found: __ZN6Gecode16ValBranchOptions3defE
Referenced from: /Users/mbaxa/.vagrant.d/gems/gems/dep_selector-1.0.3/lib/dep_gecode.bundle
Expected in: flat namespace
in /Users/mbaxa/.vagrant.d/gems/gems/dep_selector-1.0.3/lib/dep_gecode.bundle
@maewolfsky
maewolfsky / .bashrc
Created February 14, 2014 15:16
Really basic way to display the currently "active" chef-server in your bash prompt
function parse_chef_server
{
if [ -r .chef/knife.rb ]; then
knife_config='.chef/knife.rb'
elif [ -r ../.chef/knife.rb ]; then
knife_config='../.chef/knife.rb'
fi
## Make sure that the knife_config was actually set before running the grep
[[ $knife_config ]] && grep chef_server_url $knife_config | awk -F/ '{print "[chef:" $3 "]"}'
@maewolfsky
maewolfsky / gist:4677454
Created January 30, 2013 21:51
Vagrant active_support problem
$ vagrant gem
[!] ERROR -- Please install ActiveSupport (gem install activesupport)
--------------------------------------------------------------------------------
/Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- active_support/core_ext/hash/deep_merge (LoadError)
from /Applications/Vagrant/embedded/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/mbaxa/Desktop/tmp-es0.1.0-test/cookbook-elasticsearch-0.1.0/Vagrantfile:19:in `<top (required)>'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.0.6/lib/vagrant/config/loader.rb:115:in `load'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.0.6/lib/vagrant/config/loader.rb:115:in `block in procs_for_source'
@maewolfsky
maewolfsky / gist:4027756
Created November 6, 2012 21:36
Shef error
$ shef -z -c .chef/knife.rb
loading configuration: .chef/knife.rb
Session type: client
Loading...[2012-11-06T15:34:42-06:00] INFO: Run List is []
[2012-11-06T15:34:42-06:00] INFO: Run List expands to []
.[2012-11-06T15:34:43-06:00] INFO: Loading cookbooks []
done.
This is shef, the Chef shell.
Chef Version: 10.14.2