Skip to content

Instantly share code, notes, and snippets.

View jtimberman's full-sized avatar
🚀

Joshua Timberman jtimberman

🚀
View GitHub Profile
(require 'chef)
(resource :file "/tmp/foo"
:owner "cb"
:action :create)
(resource :file (concatenate 'string
"/tmp/"
(node-attributes :hostname)
"-made-with-lisp")
@jtimberman
jtimberman / README.md
Created November 19, 2013 21:15 — forked from fnichol/README.md

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?)

Some people think that configuration should not be "Turing complete"; others think the configuration language should be as expressive as possible--so much so that it amounts to a programming language itself.

I assert that configuration files which are not Turing complete (or, perhaps a more useful distinction, are not "sufficiently complex languages") are in practice extended to be that complex; and when that happens, the result is often more difficult to understand than if the language were more powerful to start with.

require 'socket'
NOT_FOUND = "HTTP/1.1 404 Not Found\nContent-Length: 9\n\nNot Found"
OK = "HTTP/1.1 200 OK\n"
socket = Socket.new(:INET, :STREAM)
sockaddr = Socket.sockaddr_in(11080, '127.0.0.1')
socket.bind(sockaddr)
socket.listen(5)
----
platforms:
- name: ubuntu-12.04
driver_config:
image_id: ami-d726abbe
username: ubuntu
- name: ubuntu-10.04
driver_config:
image_id: ami-1ab3ce73
username: ubuntu
function table() {
case "$1" in
flip)
echo "(╯°□°)╯︵ ┻━┻ "
;;
set)
echo "┬─┬ ノ( ゜-゜ノ)"
;;
man)
echo "(╯°Д°)╯︵ /(.□ . \)"
#!/usr/bin/env ruby
%w(erb git net/ssh resolv chef chef/knife/cookbook_upload chef/cookbook_uploader chef/knife/node_run_list_add chef/knife/bootstrap net/ssh/multi chef/knife/core/bootstrap_context chef/knife/ssh mixlib/cli).each do |gem|
begin
require gem
rescue LoadError
raise "Could not load gem #{gem}, please install with sudo gem install #{gem}"
end
end

The quick fix

Assuming you have homebrew installed and you use bundler, you can fix this issue by doing the following:

gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew uninstall libxslt
brew install libxml2 --with-xml2-config
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
require 'guard/guard'
require 'mixlib/shellout'
module ::Guard
class Kitchen < ::Guard::Guard
def start
::Guard::UI.info("Guard::Kitchen is starting")
if ENV['ES_CACHE']
puts "Shared cache enabled"
if ENV['ES_CACHE_TYPE'] == 'yum'
FileUtils.mkdir_p(File.join("cache","yum")) unless Dir.exists?(File.join("cache","yum"))
config.vm.share_folder("yum", "/var/cache/yum", "cache/yum")
else
FileUtils.mkdir_p(File.join("cache","apt","partial")) unless Dir.exists?(File.join("cache","apt", "partial"))
config.vm.share_folder("apt", "/var/cache/apt/archives", "cache/apt")
end
end