Skip to content

Instantly share code, notes, and snippets.

View cbednarski's full-sized avatar

Chris Bednarski cbednarski

View GitHub Profile
@cbednarski
cbednarski / packer-build.txt
Created January 21, 2016 18:20
Folder layout from a packer build
.
├── 1404-dev.json
├── 1404-min.json
├── LICENSE.md
├── Makefile
├── README.md
├── http
│   └── preseed.cfg
├── output-vbox
│   └── ubuntu-1404-vbox.vdi
@cbednarski
cbednarski / compute.js
Created January 15, 2016 18:33
Azure VM Parameters
/**
* The operation to create or update a virtual machine.
*
* @param {string} resourceGroupName The name of the resource group.
*
* @param {VirtualMachine} parameters Parameters supplied to the Create
* Virtual Machine operation.
*
* @param {Plan} [parameters.plan] Gets or sets the purchase plan when
* deploying virtual machine from VM Marketplace images.
vagrant@nomad:/opt/gopath/src/github.com/hashicorp/nomad$ time make test
--> Installing build dependencies
--> Building nomad
--> Running tests
ok github.com/hashicorp/nomad 0.007s coverage: 0.0% of statements
ok github.com/hashicorp/nomad/api 31.762s coverage: 85.0% of statements
ok github.com/hashicorp/nomad/client 24.027s coverage: 43.2% of statements
ok github.com/hashicorp/nomad/client/allocdir 0.007s coverage: 37.7% of statements
ok github.com/hashicorp/nomad/client/config 0.005s coverage: 30.8% of statements
2016/01/11 16:11:05 [DEBUG] driver.docker: using client connection initialized from environment
@cbednarski
cbednarski / repro.py
Last active October 8, 2015 22:13
Script to rerun a test to catch a race condition
import re
import subprocess
import os
small_before_re = re.compile("(\w+) /tmp/small")
big_before_re = re.compile("(\w+) /tmp/big")
small_after_re = re.compile("(\w+) small")
big_after_re = re.compile("(\w+) big")
os.putenv("PACKER_LOG", "1")
@cbednarski
cbednarski / gist:ab73a0a4e03ab1b6a37d
Created June 8, 2015 21:12
Test output fail from consul-template
ok github.com/hashicorp/consul-template 0.497s
2015/06/08 13:14:33 [DEBUG] ("file(/var/folders/mt/q5nyhg2x4hvg77ycy189g3g80000gn/T/235240652)") querying file
2015/06/08 13:14:33 [DEBUG] ("file(/var/folders/mt/q5nyhg2x4hvg77ycy189g3g80000gn/T/755766715)") querying file
2015/06/08 13:14:33 [DEBUG] ("file(/var/folders/mt/q5nyhg2x4hvg77ycy189g3g80000gn/T/755766715)") querying file
2015/06/08 13:14:33 [DEBUG] ("file(/var/folders/mt/q5nyhg2x4hvg77ycy189g3g80000gn/T/979158494)") querying file
2015/06/08 13:14:33 [DEBUG] ("file(/var/folders/mt/q5nyhg2x4hvg77ycy189g3g80000gn/T/979158494)") querying file
2015/06/08 13:14:33 [INFO] core: security barrier initialized (shares: 1, threshold 1)
2015/06/08 13:14:33 [INFO] core: post-unseal setup starting
2015/06/08 13:14:33 [INFO] rollback: starting rollback manager
2015/06/08 13:14:33 [INFO] core: post-unseal setup complete
2015/06/01 17:07:57 Running builder: foo
2015/06/01 17:07:57 ui: ==> test: Running post-processor: testPP
2015/06/01 17:07:57 Flagging to keep original artifact from post-processor 'testPP'
2015/06/01 17:07:57 Running builder: foo
2015/06/01 17:07:57 Running builder: foo
2015/06/01 17:07:57 ui: ==> test: Running post-processor: pp
2015/06/01 17:07:57 Deleting original artifact for build 'test'
2015/06/01 17:07:57 Running builder: foo
2015/06/01 17:07:57 ui: ==> test: Running post-processor: pp
2015/06/01 17:07:57 ui: ==> test: Running post-processor: pp
@cbednarski
cbednarski / install-consul.sh
Last active September 27, 2020 17:53
Ubuntu installer script for consul
set -x
mkdir -p /tmp/consul
cd /tmp/consul
# Consul Configuration File
tee consul.json <<CONSULCONFIG
{
"bootstrap_expect": 3,
"client_addr": "0.0.0.0",
@cbednarski
cbednarski / rest-routines.go
Last active August 29, 2015 14:13
A demo of goroutines in go.
package main
// This program makes HTTP requests to three different URLs using goroutines.
// You can think of a goroutine as a forked process, and what you should see is
// that slower HTTP calls will appear last in the output, even if they appear
// first in the code.
//
// In my case, bbc.co.uk takes longest to respond and appears last in the
// program's output, even though it appears first in the code.
@cbednarski
cbednarski / replcheck.php
Created April 30, 2014 05:34
MySQL Replication Healthcheck
<?php
$username = '';
$password = '';
$servers = array(
'127.0.0.1',
);
class ReplicationCheck
{
@cbednarski
cbednarski / mongo_doc.py
Created April 8, 2014 21:27
Lightweight MongoDB abstraction around python classes
class MongoDoc(object):
connection = None
__fields__ = {}
__required__ = []
__optional__ = []
__meta__ = ['_id', 'updated']
def set_data(self, data):
'''
You can set individual fields like this: