Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Isaac Johnston superstructor

Block or report user

Report or block superstructor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:27af5b8dad8c60a6e95c

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:


Docker stats collection for collectd

This script can be used to feed collectd with cpu and memory usage statistics for running docker containers using the collectd exec plugin.

This script will report the used and cached memory as well as the user and system cpu usage by inspecting the appropriate cgroup stat file for each running container.


This script is intented to be executed by collectd on a host with running docker containers. To use, simply configure the exec plugin in collectd to execute the script. You may need to adjust the script to match your particulars, such as the mount location for cgroup.


How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

View gist:fa91dcadb70597631112
lol = log --graph --decorate --pretty=oneline --abbrev-commit
logola = log --graph --decorate --pretty=oneline --abbrev-commit --all
name = Isaac Johnston
email =
excludesfile = /Users/isaac/.gitignore_global
editor = vim
View gist:765df8bd2eddb02d21eb
docker run -v /opt/bin:/opt/bin --rm /bin/bash -c "git clone && cd etcd && ./build && cp bin/etcd /opt/bin"
View gist:e234e08bf0e369c4989d
function errexit() {
local err=$?
set +o xtrace
local code="${1:-1}"
echo "Error in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}. '${BASH_COMMAND}' exited with status $err"
# Print out the stack trace described by $function_stack
if [ ${#FUNCNAME[@]} -gt 2 ]
echo "Call tree:"
for ((i=1;i<${#FUNCNAME[@]}-1;i++))
View gist:db3941793fd51a6c90b3
// This systemd runs iptables-restore on boot:
Description=Packet Filtering Framework
ExecStart=/usr/sbin/iptables-restore /opt/docker/scripts/iptables/iptables.rules
superstructor / gist:5754905
Created Jun 11, 2013
Or for a coffee order maybe consider that the order and the payment could be independent resources, thus you get
View gist:5754905
"_links": {
"self": {
"href": "/api/orders/123"
"profile": {
"href": "/profiles/order"
"/rels/payments": {
"href": "/api/orders/123/payments",
superstructor / gist:5754903
Last active Dec 18, 2015
"/rels/delete" could tell the client "this is the link to follow to delete the context resource", whereas "/profiles/delete" could tell the client that to do so you DELETE /api/customer/42 ? Since there is no entity body the generic /profiles/delete provides enough semantics for any resource i.e. just use the DELETE method. "/rels/update-form" c…
View gist:5754903
"_links": {
"self": {
"href": "/api/customers/42"
"profile": {
"href": "/profiles/customer"
"/rels/delete": {
"href": "/api/customers/42",
You can’t perform that action at this time.