Skip to content

Instantly share code, notes, and snippets.

brettcave / role-just-java.json
Last active Aug 29, 2015
role to install java 7
View role-just-java.json
"name": "just-java",
"description": "Installs Java 7",
"chef_type": "role",
"json_class": "Chef::Role",
"override_attributes": {
"java": {
"jdk_version" : "7",
"java_home" : "/usr/java/latest",
"install_flavor": "oracle",
brettcave / gist:70d13cfaa58d6ef160e1
Created Jun 25, 2014
apt-get workaround for build-essential
View gist:70d13cfaa58d6ef160e1
a = bash "apt-get update" do
user "root"
code <<-EOF
add-apt-repository ppa:cwchien/gradle
apt-get update
action :nothing
a.run_action :run
View output.log
$ cat
cd /opt/chef-zero
chef-client -z -c solo.rb -o 'role[someRole]' -E BUILD > chef-zero.log 2>&1
$ cat chef-zero.log
[2014-06-11T10:31:28+00:00] INFO: Auto-discovered chef repository at /opt/chef-zero
[2014-06-11T10:31:29+00:00] INFO: Starting chef-zero on port 8889 with repository at repository at /opt/chef-zero
One version per cookbook
[2014-06-11T10:31:29+00:00] INFO: Forking chef instance to converge...
brettcave / java-rc-junit4-custom.js
Created Mar 12, 2014
Custom Java / JUnit formatter for selenium
View java-rc-junit4-custom.js
* Format for Selenium Remote Control Java client using the Firefox WebDriver
* Author: Brett Cave <>
* Date: Fri May 06, 2011
var subScriptLoader = Components.classes[";1"].getService(Components.interfaces.mozIJSSubScriptLoader);
subScriptLoader.loadSubScript('chrome://selenium-ide/content/formats/remoteControl.js', this); = "java-rc-junit4-custom";
brettcave / KMEx2InConverter.js
Created Feb 3, 2014
nodejs kissmetrics export to import converter
View KMEx2InConverter.js
var fs = require("fs"),
function parseResults(filename) {
fs.readFile(filename, 'utf-8', function (err, fileContents) {
if (err) throw err;
var parsedJson = JSON.parse(fileContents);
for (element in parsedJson) {
var params = "?_k=" + API_KEY + "&_d=1"
View gist:7672829
var UpdatePull = function() {;
util.inherits(UpdatePull, events.EventEmitter);
UpdatePull.prototype.pull = function() {
var self = this;
_.each(result, (function(item){
View gist:7672685
var fs = require('fs')
fs.exists("/path/to/some/file", function(exists) {
var foo = "bar"
if (exists)
foo = "foobar";
module.exports = foo;
View gist:7642572
libraryDependencies ++= {
Seq("" % "mylib" % "1.0.0")
brettcave / gist:7449050
Created Nov 13, 2013
chef-solo ordering of run lists
View gist:7449050
[2013-11-13T12:17:31+00:00] INFO: Setting the run_list to ["recipe[java]", "recipe[foo::bar]", "recipe[some::thing]", "recipe[yack::foo]"] from JSON
[2013-11-13T12:17:31+00:00] INFO: Run List is [recipe[java], recipe[foo::bar], recipe[some::thing], recipe[yack::foo]]
[2013-11-13T12:17:31+00:00] INFO: Run List expands to [java, foo::bar, some::thing, yack::foo]
Recipe: yack::foo
brettcave / gist:7082764
Created Oct 21, 2013
Write secret key file and then reference it
View gist:7082764
get_file = ruby_block "get_file" do
block do
conn ="param")
remoteFile = conn.get("/path/to/file")
localFile ="/tmp/test_secret_key",'w')
not_if { ::File.exists?("/tmp/test_secret_key") }
action :nothing