Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
COUCHDB_URI="http://localhost:5984/chef"
curl -H "Content-Type: application/json" -X POST $COUCHDB_URI/_compact >/dev/null 2>&1
for i in users sandboxes roles nodes id_map data_bags cookbooks clients checksums; do
curl -H "Content-Type: application/json" -X POST $COUCHDB_URI/_compact/$i >/dev/null 2>&1;
done
@atomic-penguin
atomic-penguin / gist:742934
Created December 16, 2010 02:33
erbcheck.sh
#!/bin/bash
if [ ! "$1" ]; then
echo -e "\nRuby ERB syntax checker."
echo -e "Usage: `basename $0` <filename>\n"
else
erubis -x -T '-' "$1" | ruby -c
fi
# If x86
if node[:kernel][:machine] =~ /^(x|i[3456])86$/i
# Do something
end
# If amd64/x86_64 (same thing)
if node[:kernel][:machine] =~ /^(x86_|amd)64$/i
# Do something
end
gource -1280x800 -a 1 -s 1 -i 10000000000 --max-file-lag 3 --max-files 100000 --hide-filenames --highlight-all-users --disable-bloom --hide-progress --hide-mouse --user-image-dir .git/avatar
@atomic-penguin
atomic-penguin / README.md
Created October 20, 2011 19:10
multi-knife-howto

Overview

Here is an example shared configuration for knife. You can drop this off in your chef-repo/.chef/ directory, and multiple developers can use the same knife configuration to interact with more than one Chef server, or the Opscode platform.

By using Bash functions and environment variables we can change the chef server, which knife is configured to use, on the fly.

NOTE: knife will probably ignore your ~/.chef/knife.rb once you begin using a shared knife.rb in your chef-repo directory.

Preparation

@hartmantis
hartmantis / spec_helper.rb
Last active November 15, 2017 15:50
ChefSpec stubs for testing a recipe in isolation
require 'chefspec'
module SpecHelper
def global_stubs
# Don't worry about external cookbook dependencies
Chef::Cookbook::Metadata.any_instance.stub(:depends)
# Test each recipe in isolation, regardless of includes
@included_recipes = []
Chef::RunContext.any_instance.stub(:loaded_recipe?).and_return(false)
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm