Skip to content

Instantly share code, notes, and snippets.

View jhulten's full-sized avatar

Jeffrey Hulten jhulten

View GitHub Profile
#!/bin/bash
JQPATH=$(which jq)
if [ "x$JQPATH" == "x" ]; then
echo "Couldn't find jq executable." 1>&2
exit 2
fi
set -eu
shopt -s nullglob
@shykes
shykes / gist:7776351
Last active December 30, 2015 04:29

Simple ambassador container

The Simple Ambassador Container (let's just call it the ambassador) is a reusable container which can be added to your stack to represent a remote service. Using an ambassador your application can discover remote services using docker's standard links features.

Usage

Example usage:

REDIS_REMOTE_IP=1.2.3.4
@jpetazzo
jpetazzo / gist:6127116
Created July 31, 2013 23:21
Debian/Ubuntu containers protips, thanks to @spahl
# this forces dpkg not to call sync() after package extraction and speeds up install
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup
# we don't need and apt cache in a container
RUN echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache
@rodionmoiseev
rodionmoiseev / gist:2484934
Created April 25, 2012 00:41
Setting up Play 2.0 in build.gradle
apply plugin: 'java'
apply plugin: 'scala'
// For those using Eclipse or IntelliJ IDEA
apply plugin: 'eclipse'
apply plugin: 'idea'
def findPlay20(){
def pathEnvName = ['PATH', 'Path'].find{ System.getenv()[it] != null }
for(path in System.getenv()[pathEnvName].split(File.pathSeparator)){
for(playExec in ['play.bat', 'play.sh', 'play']){
@henrikengstrom
henrikengstrom / gist:2239521
Created March 29, 2012 16:32
Using specific config settings with TestKit - example 1
import akka.testkit.{TestActorRef, TestKit}
import com.typesafe.config.ConfigFactory
import org.scalatest.matchers.MustMatchers
import org.scalatest.WordSpec
import akka.actor.{Actor, ActorSystem}
@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner])
class Example1 extends TestKit(
ActorSystem("TestSystem", ConfigFactory.parseString("""{ test.value = "Hey, it works!" }""")))
with WordSpec
@jbz
jbz / knife.rb
Created February 16, 2011 17:08
knife.rb that switches Opscode orgs/validators based on git branch
# This knife.rb orig. provided by jtimberman@opscode.com - but any mistakes are mine!
current_dir = File.dirname(__FILE__)
platform = "https://api.opscode.com/organizations"
require 'grit'
branch = Grit::Repo.new("#{current_dir}/..").head.name
case branch
@lusis
lusis / split-em.rb
Created November 22, 2010 21:42
Splits a single JSON array file into distinct files for data bags in chef
require 'json'
require 'optparse'
all_json = []
options = {}
options[:overwrite] = false
optparse = OptionParser.new do |opts|
opts.banner = "Usage: split-em -f FILE -d DATABAG [-o]"
opts.on( '-f' ,'--file FILE', 'JSON file to split') do |file|
@kennethkalmer
kennethkalmer / README
Created October 28, 2010 11:26
Sample mysql_grant provider for Chef
Prototype mysql_grant provider for Chef
---------------------------------------
Drop the two files into your mysql cookbook, and experiment with the following examples:
mysql_grant "kenneth" do
action :grant
username "root" # <- User with admin privs
password node[:mysql][:server_root_password]
# Actual grant details
@matthewmccullough
matthewmccullough / gist:47267
Created January 15, 2009 05:15 — forked from halbtuerke/gist:31934
Show Git dirty status in your Unix bash prompt (symbols not compatible with CygWin)
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"