Skip to content

Instantly share code, notes, and snippets.

View benton's full-sized avatar

Benton Roberts benton

View GitHub Profile
@benton
benton / keybase.md
Last active January 21, 2017 21:43
keybase.md

Keybase proof

I hereby claim:

  • I am benton on github.
  • I am benton (https://keybase.io/benton) on keybase.
  • I have a public key whose fingerprint is A245 1868 59DE 504F 8A05 8E9B 1728 A3E4 0D9F B348

To claim this, I am signing this object:

@benton
benton / latest_ubuntu_ami.rb
Created March 9, 2017 15:07
Fetch latest Canonical Ubuntu AMI ID for a given region
require 'aws-sdk-resources'
require 'diskcached'
# ...
CANONICAL_AWS_ID = '099720109477' # AWS ID for Ubuntu's publisher
DATE_MATCHER = /(\d\d\d\d)(\d\d)(\d\d)(\.\d+)?\Z/
# Returns the latest Canonical Ubuntu AMI for a given
# Ubuntu version, AWS region, architecture, and root device type.
@benton
benton / clasp-build-log.txt
Created March 15, 2017 18:45
Log from failed build of clasp
[462/606] Compiling src/gctools/boehmGarbageCollection.cc
[463/606] Compiling src/gctools/gc_interface.cc
In file included from ../../src/gctools/gc_interface.cc:201:
../../src/main/clasp_gc_cando.cc:9658:92: error: no member named '_BformatStringOutputStream' in 'GCRoots'
{ fixed_field, SMART_PTR_OFFSET, sizeof(gctools::smart_ptr<core::StringOutputStream_O>), offsetof(SAFE_TYPE_MACRO(core::Lisp_O),_Roots._BformatStringOutputStream), "_Roots._BformatStringOutputStream" }, // public: (T T) fixable: SMART-PTR-FIX good-name: T
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/app/externals-clasp/build/release/bin/../lib/clang/4.0.0/include/stddef.h:120:24: note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
^ ~
In file included from ../../src/gctools/gc_interface.cc:201:
@benton
benton / Dockerfile
Last active May 1, 2017 17:52
LLVM 4.0 installation broken on Ubuntu 16.04?
FROM ubuntu:latest
RUN apt-get update && apt-get -y upgrade && apt-get install -y curl
RUN echo 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main' \
>/etc/apt/sources.list.d/llvm.list
RUN echo 'deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main' \
>>/etc/apt/sources.list.d/llvm.list
RUN curl http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN apt-get update && apt-get -y install clang-4.0
@benton
benton / track-icmp-state.sh
Last active October 28, 2017 18:38
Ping an IP forever and report its reachability
#!/usr/bin/env bash
# pings an IP address forever and tracks whether it is accessible
# logs the connection's state change to $STDOUT
ip='8.8.8.8'
track_attempts=5
failure_threshold=3
delay=1
# track state
@benton
benton / track-icmp-state.sh
Created November 1, 2017 20:58
Track ISP uptime
#!/usr/bin/env bash
# pings an IP address forever and tracks whether it is accessible
# logs the connection's state change to $STDOUT
ip='8.8.8.8'
track_attempts=5
failure_threshold=3
delay=1
# track state
@benton
benton / process-track-ip-state.clj
Created November 1, 2017 20:59
Process output of track-icmp-state.sh
#!/usr/bin/env boot
; Converts track-imcp-state.sh output into minute-by-minute CSV datapoints
; Requirements: Java 8 and Boot
; Use "brew install boot-clj", or see https://github.com/boot-clj/boot
; Best used with only one day's worth of logs at a time from STDIN, like this:
; cat [output.log] | grep [DATE] | ./process-track-ip-state.clj > [DATE].csv
(set-env! :dependencies '[[clj-time "0.14.0"]])
(require '[clj-time.core :as t])
(require '[clj-time.format :as f])
@benton
benton / keybase.md
Created November 26, 2017 20:13
keybase.md

Keybase proof

I hereby claim:

  • I am benton on github.
  • I am benton (https://keybase.io/benton) on keybase.
  • I have a public key whose fingerprint is 10A5 332B B35A A180 92FB ABFE FDD8 EE01 E3F3 87AB

To claim this, I am signing this object:

@benton
benton / dualboot.md
Last active June 5, 2018 11:37
Dual-booting Ubuntu 13 on a MacBook Pro

Dual-booting Ubuntu alongside OS X on your MacBook Pro

dual_boot!

Why do this?

  1. To run a broader array of software than with OS X alone.
  2. To run faster, by more fully exploiting the hardware, and by running with a smaller memory footprint.
  3. To more fully customize the user interface.
@benton
benton / How to Build Like Medistrano.md
Last active October 29, 2020 17:34
How to Build Like Medistrano

How to Build Like Medistrano

By simulating Medistrano's Docker image build process on your own workstation, you get immediate feedback, plus use of the local Docker cache. This can help catch or reproduce problems much more quickly than by repeatedly committing changes to GitHub, then asking Medistrano to perform a build. Here are some instructions that should help you accomplish that.

Prerequisites

Before runnig docker build in your app's checkout directorty, you should make sure you can authenticate to any hosts that might require access during the build process.