Skip to content

Instantly share code, notes, and snippets.

View smerrill's full-sized avatar
🤖
Attention is all you need

Steven Merrill smerrill

🤖
Attention is all you need
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class RepeatTableHeadersHandler extends Paged.Handler {
constructor(chunker, polisher, caller) {
super(chunker, polisher, caller)
this.splitTablesRefs = []
}
afterPageLayout(pageElement, page, breakToken, chunker) {
this.chunker = chunker
this.splitTablesRefs = []
// 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() {
@smerrill
smerrill / apt-cacher-ng-docker-os-x.md
Created November 12, 2016 21:56 — forked from ismith/apt-cacher-ng-docker-os-x.md
Local apt repo cache using docker

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 October 26, 2016 19:31
Build a Dirty COW-proof Amazon Linux AMI for use with Elastic Beanstalk
{
"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",
@smerrill
smerrill / mix.exs
Last active October 16, 2015 05:16
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 August 29, 2015 14:23
Run Ansible on the Vagrant guest if you're on Windows.
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
This is GhostScript 9.14.7, rebuilt for EL6.
# 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

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