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
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 = []
@smerrill
smerrill / gist:10544237
Last active August 4, 2023 12:26
Socket Activation Notes
Socket activation:
NGINX=3:4
ListenStream=10646 (IPv6)
ListenStream=0.0.0.0:10646 (IPv4)
BindIPv6Only=ipv6-only
nginx.conf:
server {
// 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 / map.geojson
Created October 27, 2013 01:59
Phase2 Office Locations
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@smerrill
smerrill / create-openshift-user.sh
Created September 22, 2013 15:45
Script to create an OpenShift user on an OpenShift broker.
$ cd /var/www/openshift/broker
$ rails console
irb(main):> a = OpenShift::MongoAuthService.new()
=> #<OpenShift::MongoAuthService:0x00000004507db0 @salt="changeme">
irb(main):> a.register_user('steven','merrill')
=> true
@smerrill
smerrill / openshift-lein.sh
Created August 30, 2013 17:22
Download and run leiningen (for Clojure) in an OpenShift DIY cartridge.
HTTP_CLIENT="curl --insecure -f -L -o" LEIN_HOME=$OPENSHIFT_DATA_DIR/.lein LEIN_JVM_OPTS="-Duser.home=$OPENSHIFT_DATA_DIR" lein
$ cat ~/bin/rhc-oo
#!/bin/bash
rhc $@ -ladmin -padmin --server <your origin server's FQDN> -k
#!/bin/bash
LASTSECTOR=`fdisk -l | grep /dev/vda1 | awk '{ print $4 }'`
/bin/echo "d
2
n
p
2
$LASTSECTOR