Skip to content

Instantly share code, notes, and snippets.


Bryan Robbins bryantrobbins

View GitHub Profile
bryantrobbins /
Created Sep 29, 2017
ElasticMQ as a local drop-in for AWS SQS in a SpringBoot + Spring JMS setup
// AWS provides a JMS library for SQS:
// I wanted to use that setup in a Spring Boot app, and to run some tests against an in-memory
// ElasticMQ queue, which is SQS (and AWS Java SDK) compatible. In case your scenario is EXACTLY like mine ... here you go
// This annotation is important: Forces the Application Context (and SQS connections) to reset between tests. ElasticMQ will fail to
// stop if there are active connections.
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
public class ApplicationTests {
View Jenkins EC2 Docker install
# Get package updates
sudo yum update -y
# Check if docker installed
installed=`yum list installed | grep docker`
if [[ -z "${installed}" ]]; then
# Docker install steps required for AMI (Amazon Linux)
sudo yum install docker -y
sudo service docker start
bryantrobbins / facts.rb
Created Jun 17, 2016
Custom facts for AWS EC2 instances
View facts.rb
Facter.add(:ec2_availability_zone) do
setcode do
Facter::Core::Execution.exec('curl -s')
Facter.add(:aws_region) do
setcode do
az = Facter.value(:ec2_availability_zone)
bryantrobbins / hiera.yaml
Last active Jun 17, 2016
Local puppet configuration sample
View hiera.yaml
- yaml
:datadir: "/root/init/datadir"
- custom
- "hosts/%{::aws_cloudformation_logical_id}"
- common
View for Masterless Puppet
#!/bin/bash -v
echo "Updating packages"
yum update -y
echo "Installing yum packages"
yum install -y rubygems git puppet3
echo "Installing rubygems"
gem install r10k hiera-eyaml hiera-eyaml-kms
View BuildHost spec
"BuildServer" : {
"Type" : "AWS::EC2::Instance",
"DependsOn" : "AttachGateway",
"Metadata" : {
"AWS::CloudFormation::Init" : {
"config" : {
"sources" : {
"/root" : ""
"files" : {
bryantrobbins /
Last active Nov 14, 2016
Running a packer build which pushes an nginx-based image of a static website AWS ECR
#!/bin/bash -v
# Add your app build steps here
# Assume that these steps produce a "dist" folder at this level
# Prepare packer variables
chmod 700
./ $repoName $imageVersion > variables.json
View filter.R
# I am a novice at R, so please forgive this example.
# After hours of Google-ing, tweaking, and trying a bunch of stuff, this was the only
# way I could come up with for constructing a set of columns to be dropped from a data.table,
# then dropping those columns.
# I expect that any R pros that stumble across this may have comments. Please feel free to suggest edits/leave comments.
# Library loading
bryantrobbins / build.gradle
Last active Aug 29, 2015
A quick script to get the # of builds in the "Build Queue" - i.e., the number of builds which are awaiting an open Executor slot - in Jenkins.
View build.gradle
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'groovy'
repositories {
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.8'
bryantrobbins / build.gradle
Created Aug 17, 2015
Jenkins parallel grid search; I've copied some code from a helper class here to simplify the example (you'll notice that JenkinsClient is really written as "Java" instead of Groovy). I just wanted the example to be self-contained - there are definitely much more "Groovy" ways to make HTTP calls like the ones our Groovy code needs to make.
View build.gradle
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'groovy'
import static com.xlson.groovycsv.CsvParser.parseCsv
// Load properties or defaults
def min_gamma_val = hasProperty('min_gamma') ? min_gamma : ''