Skip to content

Instantly share code, notes, and snippets.

View jmervine's full-sized avatar

Joshua Mervine jmervine

View GitHub Profile
@jmervine
jmervine / Makefile
Last active November 28, 2018 18:53
# Override github.com/splunk/docker-splunk build args
# ---
# SPLUNK_ANSIBLE_BRANCH ?= master
# SPLUNK_VERSION ?= 7.2.0
# SPLUNK_BUILD ?= 8c86330ac18
# Choose a github.com/splunk/docker-splunk branch to deploy
DOCKER_SPLUNK_BRANCH ?= master
IMAGE ?= splunk-edge
@jmervine
jmervine / ssl_test.md
Created October 20, 2013 19:54
SSL Test Node.js/SPDY/Express.js vs. Nginx/SPDY vs. Nginx/SPDY -> Node.js/Express.js

HTTPS Test using SPDY

Node.js+node-spdy vs Nginx+SPDY

This is by no means a comprehensive test. It was done a laptop with a dump of Google's homepage as the content. Performance data was generated using 10000 connections to localhost using `httperf'. If you see any glaring holes though, please point them out. Cheers!

Findings summary:

  1. Node.js / node-spdy / Express.js: avg 139.1
  2. Nginx / SPDY -> Node.js / Express.js: avg 150.1
@jmervine
jmervine / foo.tf
Last active November 1, 2018 16:36
provider "helm" {
kubernetes {
config_path = "${local_file.kubeconfig.filename}"
}
}
provider "helm" {
kubernetes {
host = "${aws_eks_cluster.eks_master.endpoint}"
cluster_ca_certificate = "${base64decode(aws_eks_cluster.eks_master.certificate_authority.0.data)}"
# Simply ensure repo and return url
aws ecr create-repository --repository-name $1 2>/dev/null || true
echo "$(aws ecr describe-repositories --repository-name $1 | jq '.repositories[0].repositoryUri')"
@jmervine
jmervine / newrelic.yml
Created June 16, 2012 19:30
Default NewRelic Configuration
#
# This file configures the New Relic Agent. New Relic monitors
# Ruby, Java, .NET, PHP, and Python applications with deep visibility and low overhead.
# For more information, visit www.newrelic.com.
#
# Generated June 16, 2012
#
# This configuration file is custom generated for AT&T Interactive
# Here are the settings that are common to all environments:
@jmervine
jmervine / app.js
Created January 28, 2015 00:17
node file upload
app.post('/upload', function (req, res){
var form = new formidable.IncomingForm();
form.hash = 'md5';
form.multiples = true;
function parseForm(err) {
if (err) console.error(err);
res.redirect('/');
}

Intro to Docker

What's Docker?

Per Docker;

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications. Consisting of Docker Engine, a portable, lightweight runtime and packaging tool, and Docker Hub, a cloud service for sharing applications and automating workflows, Docker enables apps to be quickly assembled from components and eliminates the friction between development, QA, and production environments. As a result, IT can ship faster and run the same app, unchanged, on laptops, data center VMs, and any cloud.

https://www.docker.com/

@jmervine
jmervine / p.rb
Last active October 13, 2017 05:58
#!/usr/bin/env ruby
# Modifying Float and Integer for fun.
class Float
def whole?
n = self
!!( n % 1 == 0 )
end
end
class Integer
@jmervine
jmervine / main.go
Last active October 3, 2017 18:32
Fetch a file from a private repo on github.
package main
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
)
fake_rand = `hostname`.hash % 6
if config["STUNNEL_AUTORESTART"]
cron "stunnel-restart cron job" do
command "/sbin/restart stunnel-mod-gearman-worker-ssl"
minute [0, 15, 30, 45].map { |i| fake_rand + i }.join(", ")
mailto "srtools@heroku.com"
user "root"
action :create
end
else