Skip to content

Instantly share code, notes, and snippets.

@bmarini
bmarini / local-replication.sh
Created August 25, 2011 01:18
Local Replica Set
mkdir ~/tmp_mongo_data1
mkdir ~/tmp_mongo_data2
mkdir ~/tmp_mongo_data3
# In separate terminals
mongod --dbpath ~/tmp_mongo_data1 --port 5000 --replSet ben
mongod --dbpath ~/tmp_mongo_data2 --port 5001 --replSet ben
mongod --dbpath ~/tmp_mongo_data3 --port 5002 --replSet ben
# Then setup replication in a 4th terminal
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@stephenlauck
stephenlauck / joyent-smartos.erb
Created June 26, 2012 22:57 — forked from benjaminws/joyent-smartos.erb
joyent-smartos.erb
# shove this in ~/.chef/bootstrap/joyent-smartos.erb
# run knife bootstrap <hostname> -d joyent-smartos
# works with joyent images:
# 01b2c898-945f-11e1-a523-af1afbe22822 smartos 1.6.3 smartos smartmachine
# f9e4be48-9466-11e1-bc41-9f993f5dff36 smartos64 1.6.3 smartos smartmachine
bash -c '
if [ ! -f /opt/local/bin/chef-client ]; then
pkgin -f update
pkgin -y install gcc-compiler gcc-runtime gcc-tools scmgit-base scmgit-docs gmake ruby193-base ruby193-yajl-ruby
@jmazzi
jmazzi / chef.rb
Created July 27, 2012 03:26 — forked from gmcmillan/chef.rb
Simple Ruby class for manually querying the Chef REST API (using Net::HTTP instead of Chef's REST resources)
require 'base64'
require 'time'
require 'digest/sha1'
require 'openssl'
require 'net/https'
require 'json'
class Chef
attr_accessor :http, :path
@micgo
micgo / ec_node_fixer.rb
Created October 30, 2013 03:32
This should fix missing permissions on Enterprise Chef 11 after download/upload operations
#!/usr/bin/env ruby
require 'rubygems'
require 'chef/knife'
Chef::Config.from_file(File.join(Chef::Knife.chef_config_dir, 'knife.rb'))
rest = Chef::REST.new(Chef::Config[:chef_server_url])
Chef::Node.list.each do |node|
%w{read update delete grant}.each do |perm|
@fnichol
fnichol / README.md
Last active April 27, 2023 15:24
Auto-enable Local HTTP Caching in Test Kitchen

Auto-enable Local HTTP Caching in Test Kitchen

Note: total experiment and hack, looks nasty, could be awesome:

Setup

  • Drop the kitchen.local.yml into $HOME/.kitchen/config.yml
  • Install polipo (with Mac: brew install polipo, with Ubuntu: apt-get install polipo)
  • Drop polipo-start and polipo-console somewhere useful (perhaps $HOME/bin?)
@micgo
micgo / Guardfile
Created January 2, 2014 20:59
Chefspec + Foodcritic + Test-Kitchen + Guard
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'kitchen' do
watch(%r{test/.+})
watch(%r{^recipes/(.+)\.rb$})
watch(%r{^attributes/(.+)\.rb$})
watch(%r{^files/(.+)})
watch(%r{^templates/(.+)})
watch(%r{^providers/(.+)\.rb})
@irvingpop
irvingpop / orgmapper_all_client_versions.rb
Last active August 29, 2015 14:00
Orgmapper snippet to output all nodes with client versions in all organizations to a JSON file
# Orgmapper snippet to output all nodes with client versions in all organizations to a JSON file
# To Use:
# 1) Start orgmapper
# 2) Load the script
# eval(::File.read("/path/to/orgmapper_all_client_versions.rb"))
# 3) output will be printed to the screen and also written to JSON_OUTPUT_FILE
JSON_OUTPUT_FILE = 'chef_versions.json'
@irvingpop
irvingpop / check-data.rb
Last active August 29, 2015 14:01
knife-ec-backup data validation
#!/opt/chef/embedded/bin/ruby
require 'json'
class Checker
def check
check_cookbook_metadata
check_node_sizes
check_bad_platform_metadata
check_bad_invitations
check_duplicates_in_groups
@afiune
afiune / Kitchen Driver: EC2 Windows support
Last active May 9, 2018 21:54
Making test-kitchen/kitchen-vagrant works with WindowsGuest using WinRM protocol [Progress]
salimafiune@afiunechef:~/github/tk-windows
$ kitchen list
Instance Driver Provisioner Last Action
default-windows-2008R2-SP1 Ec2Windows ChefZero Converged
salimafiune@afiunechef:~/github/tk-windows
$ kitchen destroy
-----> Starting Kitchen (v1.3.0)
-----> Destroying <default-windows-2008R2-SP1>...
EC2 instance <i-923c0ab9> destroyed.
Finished destroying <default-windows-2008R2-SP1> (0m2.43s).