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 = []
// 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 / lxc-centos
Created February 28, 2013 17:38 — forked from hagix9/lxc-centos
#!/bin/bash
#
# template script for generating CentOS container for LXC
#
#
# lxc: linux Container library
# Authors:
@smerrill
smerrill / VagrantFile
Created November 8, 2012 04:58
VagrantFile
Vagrant::Config.run do |config|
config.vm.define :lucid32 do |lucid32_config|
lucid32_config.vm.box = "lucid32"
lucid32_config.vm.forward_port 22, 22221
lucid32_config.vm.network :hostonly, "172.30.30.1"
end
config.vm.define :lucid64 do |lucid64_config|
lucid64_config.vm.box = "lucid64"
lucid64_config.vm.forward_port 22, 22222
class drush::files {
file { "/usr/share/pear/drush/drushrc.php":
ensure => present,
source => "puppet:///modules/drush/$environment/drushrc.php",
require => Class["drush::packages"],
}
file { "/usr/share/pear/drush/aliases.drushrc.php":
ensure => present,
source => "puppet:///modules/drush/$environment/aliases.drushrc.php",
@smerrill
smerrill / gist:1197979
Created September 6, 2011 16:00 — forked from johnrobertwilson/gist:1197958
Air Apache Vhost settings
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
$form['chart_options']['plot']['plot_background_color'] = array(
'#type' => 'textfield',
'#title' => t('Page Title Color'),
'#default_value' => '#FFF',
'#description' => '<div id="plot_background_colorpicker"></div>',
'#size' => 9,
'#maxlength' => 7,
'#attached' => array(
// Add Farbtastic color picker.
'library' => array(
ctags --langmap=php:.engine.inc.module.theme.php.install.test.profile \
--php-kinds=cdfi \
--languages=php \
--recurse \
--exclude="\.git" \
--exclude="\.svn" \
--exclude="\.hg" \
--exclude="\.bzr" \
--exclude="\CVS" \
--totals=yes \