Skip to content

Instantly share code, notes, and snippets.

Avatar

Steven Merrill smerrill

View GitHub Profile
View auto-cornify.js
// add event helper
function addEvent( obj, type, fn ) {
if ( obj.addEventListener ) {
obj.addEventListener( type, fn, false );
} else if ( obj.attachEvent ) {
obj.attachEvent( "on" + type, fn );
}
}
function cornifyThisGuy() {
View apt-cacher-ng-docker-os-x.md

This uses two containers - one running apt-cacher-ng, and one running rawdns. In fact, this gist is mostly based on the apt-cacher-ng hack documented the rawdns repo.

This includes a few quirks for OS X, which I'll make note of.

  1. Edit ('create') /etc/rawdns.json to look like the rawdns.json in this gist.
  2. Run a rawdns container: docker run -d --name rawdns -p 53:53/udp -v /var/run/docker.sock:/var/run/docker.sock -v /private/etc/rawdns.json:/etc/rawdns.json:ro tianon/rawdns rawdns /etc/rawdns.json. Note that this references /private/etc/rawdns.json; this is because on OS X, /etc is symlinked to /private/etc, and you can't mount a symlink.
  3. Update your DNS resolver to use 127.0.0.1! Assuming OS X, this is in the Network preference pane, behind Advanced -> DNS.
  4. dig dns.docker should now include SERVER: 127.0.0.1#53(127.0.0.1).
  5. Ru
@smerrill
smerrill / template.json
Created Oct 26, 2016
Build a Dirty COW-proof Amazon Linux AMI for use with Elastic Beanstalk
View template.json
{
"builders": [{
"type": "amazon-ebs",
"region": "us-east-1",
"source_ami": "ami-c481fad3",
"instance_type": "t2.micro",
"ssh_username": "ec2-user",
"ssh_timeout": "5m",
"vpc_id": "vpc-99999999",
"subnet_id": "subnet-99999999",
View mix.exs
defmodule Stocks.Mixfile do
use Mix.Project
def project do
[app: :stocks,
version: "0.0.1",
elixir: "~> 1.1",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
@smerrill
smerrill / Vagrantfile
Last active Aug 29, 2015
Run Ansible on the Vagrant guest if you're on Windows.
View Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "centos/7"
# These lines are for testing gatling-rsync-auto on Windows; you can probably comment
# them out and just have ansible-playbook look for /vagrant/playbook.yml.
config.vm.synced_folder "files", "/opt/vagrant/rsynced_folder", type: "rsync"
config.gatling.rsync_on_startup = true
# On Windows, run ansible in the VM.
if RUBY_PLATFORM =~ /mswin|mingw|cygwin/ then
View README.txt
This is GhostScript 9.14.7, rebuilt for EL6.
View logstash.conf
# A sample Logstash configuration to parse logs shipped with rsyslog.
# See also information about
input {
file {
path => "/var/log/rsyslog/*/*.log"
exclude => "*.bz2"
type => syslog
sincedb_path => "/var/run/logstash/sincedb"
sincedb_write_interval => 10
View vagrant-docker-speeds.md

The Test

This test times how long it takes to run puppet apply to install a large amount of monitoring software on a Docker container using the Vagrant 1.6 Docker provisioner. It is a mixed test that measures network speed (downloading large packages and plugins,) disk performance, and CPU performance.

Linode

  • 2 GB Instance
  • Fedora 20
  • Fremont datacenter
View -
'use strict';
var OpenShift = require('node-openshift-client');
var util = require('util');
var qs = require('qs');
// Connect to our OpenShift Origin!
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
@smerrill
smerrill / gist:10544237
Last active Jan 21, 2022
Socket Activation Notes
View gist:10544237
Socket activation:
NGINX=3:4
ListenStream=10646 (IPv6)
ListenStream=0.0.0.0:10646 (IPv4)
BindIPv6Only=ipv6-only
nginx.conf:
server {