Skip to content

Instantly share code, notes, and snippets.

View dockerbuild.go
package main
import (
"archive/tar"
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
@gdanko
gdanko / hash2xml.rb
Last active Apr 3, 2018
A simple hash > XML converter using REXML
View hash2xml.rb
class ::Hash
require "rexml/document"
def to_xml(indent: nil, rootname: nil, output: nil, encoding: nil)
indent = indent ? indent : 2
rootname = rootname ? rootname : "root"
output = output == $stdout ? $stdout : nil
encoding = encoding ? encoding : "UTF-8"
xml = REXML::Document.new
formatter = REXML::Formatters::Pretty.new(indent)
formatter.compact = true
View gist:224a2cd42014ffd36a6f
# Inside the chef template erb file we can do this:
<%= "[mindadmin]" %>
<% node[:splunk][:roles][:miniadmin].each do |key, value| %>
<%= "#{key} = #{value}" %>
<% end %>
View gist:31e679b8abfe96ed01b0
#!/usr/bin/ruby
require "hipchat"
require "pp"
hc = HipChat.new({
"token" => "MYTOKEN"
})
hc.debug("on")
View gist:4687737
function status_fn_oor_state(jobId) {
var status_fn_oor_state_cfg = {
method: 'GET',
on: {
success: function(id, o) {
var jsonString = o.responseText;
rec = Y.JSON.parse(jsonString);
rec.data = rec.result.output;
rec.result.output = undefined;
if(rec.result.status !== 'completed' && rec.result.status !== 'completed_with_map_errors'