Skip to content

Instantly share code, notes, and snippets.

@obazoud
obazoud / purge-docker.sh
Created December 11, 2014 20:24
Purge Docker
#!/bin/bash
docker stop $(docker ps -a -q)
docker rm -f $(docker ps -a -q)
docker rmi -f $(docker images -q)

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 October 28, 2014 21:26
Restart carbon-cache if configuration changed
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) }
@obazoud
obazoud / README.md
Last active August 29, 2015 14:07 — 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?)
# 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 August 29, 2015 14:04
Chef: How to remove a recipe dynamically ?
ruby_block 'remove_dynamically_oneshot' do
block { node.run_list.remove('recipe[mycookbook::oneshot]') }
end
# -*- mode: ruby; coding: utf-8; -*-
source "https://api.berkshelf.com"
#source "https://supermarket.getchef.com"
cookbook 'chef-client', '~> 3.6.0'
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,
#!/bin/bash
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft