Skip to content

Instantly share code, notes, and snippets.

View purge-docker.sh
#!/bin/bash
docker stop $(docker ps -a -q)
docker rm -f $(docker ps -a -q)
docker rmi -f $(docker images -q)
View gist:90cd0e2151c3453531b3

Install gem before to require it at Test-Kitchen

Context

I was trying some TDD with [Tesk-Kitchen][1] and [ServerSpec][2] when I found myself in the following case scenario:

I have a integration test like this:

# cookbook_webtest/test/integration/default/serverspec/localhost/webtest_spec.rb
@obazoud
obazoud / graphite.diff
Created Oct 28, 2014
Restart carbon-cache if configuration changed
View graphite.diff
diff --git a/providers/service_runit.rb b/providers/service_runit.rb
index 5352726..1437a10 100644
--- a/providers/service_runit.rb
+++ b/providers/service_runit.rb
@@ -31,6 +31,10 @@ action :disable do
set_updated { manage_runit_service(:disable) }
end
+action :restart do
+ set_updated { manage_runit_service(:restart) }
View 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?)
View gist:ad5a321bf69a70299ffe
# This recipe is unused
# Please use RVM-Plugin for Jenkins
include_recipe "jenkins"
script "Install RVM to jenkins" do
interpreter "bash"
not_if {::File.exists?("/var/lib/jenkins/.rvm")}
code <<-EOH
sudo -u jenkins bash -c '
@obazoud
obazoud / oneshot.rb
Last active Aug 29, 2015
Chef: How to remove a recipe dynamically ?
View oneshot.rb
ruby_block 'remove_dynamically_oneshot' do
block { node.run_list.remove('recipe[mycookbook::oneshot]') }
end
View Berksfile
# -*- mode: ruby; coding: utf-8; -*-
source "https://api.berkshelf.com"
#source "https://supermarket.getchef.com"
cookbook 'chef-client', '~> 3.6.0'
View auto_increment_capacity.sql
SELECT table_schema,
table_name,
data_type,
( CASE data_type
WHEN 'tinyint' THEN 255
WHEN 'smallint' THEN 65535
WHEN 'mediumint' THEN 16777215
WHEN 'int' THEN 4294967295
WHEN 'bigint' THEN 18446744073709551615
end >> IF(Locate('unsigned', column_type) > 0, 0, 1) ) AS MAX_VALUE,
View run.sh
#!/bin/bash
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
View setenv.sh
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft