Instantly share code, notes, and snippets.

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:

View README.md

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.

Usage

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 collectd-docker.sh script. You may need to adjust the script to match your particulars, such as the mount location for cgroup.

View how-to-set-up-stress-free-ssl-on-os-x.md

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
[alias]
lol = log --graph --decorate --pretty=oneline --abbrev-commit
logola = log --graph --decorate --pretty=oneline --abbrev-commit --all
[user]
name = Isaac Johnston
email = isaac.johnston@joukou.com
[core]
excludesfile = /Users/isaac/.gitignore_global
editor = vim
[color]
View gist:765df8bd2eddb02d21eb
#!/bin/bash
docker run -v /opt/bin:/opt/bin --rm quay.io/joukou/golang /bin/bash -c "git clone https://github.com/coreos/etcd.git && 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 ]
then
echo "Call tree:"
for ((i=1;i<${#FUNCNAME[@]}-1;i++))
View gist:db3941793fd51a6c90b3
// This systemd runs iptables-restore on boot:
[Unit]
Description=Packet Filtering Framework
DefaultDependencies=no
After=systemd-sysctl.service
Before=sysinit.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/iptables-restore /opt/docker/scripts/iptables/iptables.rules
View gist:5754905
{
"_links": {
"self": {
"href": "/api/orders/123"
},
"profile": {
"href": "/profiles/order"
}
"/rels/payments": {
"href": "/api/orders/123/payments",
View gist:5754903
{
"_links": {
"self": {
"href": "/api/customers/42"
},
"profile": {
"href": "/profiles/customer"
},
"/rels/delete": {
"href": "/api/customers/42",