Skip to content

Instantly share code, notes, and snippets.


Blake Irvin bixu

View GitHub Profile
bixu /
Last active Jul 11, 2018
python & machine learning on bananapi
# execute this script directly by piping to your shell from `curl` like this:
# curl --silent | sudo bash
set -e
echo "Setting up $(hostname)..."
apt-get update
bixu /
Last active Jun 7, 2018
thoughts on service interactions for the Habitat CLI

Habitat CLI UX

What’s confusing now:

  • start does not load a service, but load starts one…
  • historically, start or load would also install a service, but this is no longer the case for start

Possible alternatives, with an imaginary workflow:

$ hab search/provides <ident>
bixu /
Last active Feb 28, 2018
vendoring Python modules with Habitat

The following code can be put in a file we source via a inside a directory representing the module to be vendored, such as Cython:

pkg_name="${PWD##*/}" # use the name of the directory containing our `` to get the `pip` module name

# libs commonly needed during Python module installs:
bixu /
Last active Oct 6, 2017
get shell in triton in about 30 seconds
set -ex
# This assumes you have a Triton account
# (see
# and that you have installed the Triton cli tools:
# `npm install -g triton`
triton instance create 7b5981c4 g4-highcpu-1G \

For macOS Sierra (10.12) and OS X El Capitan (10.11), you also need to boot into the Recovery OS (either the Recovery partition or bootable OS X install media for 10.11) and run

csrutil disable


csrutil enable --without kext

The latter will allow you to load your custom-built, unsigned kernel extensions, while keeping the rest of System Integrity Protection (SIP) in place. (Depending on your needs, other options you may want are --without fs, --without debug, --without dtrace, or --without nvram. If you specify all of them, that is equivalent to csrutil disable. The --without option takes a comma-delimited list or can be specified multiple times: --without kext,debug,dtrace is equivalent to --without kext --without debug --without dtrace). If you have any other implementation of ZFS installed, you must uninstall it and reboot before proceeding further. Similarly, if you have installed the O3X installer version, please follow the uninstallation directions before proceeding.

bixu / postgresql94.service
Created Nov 1, 2016
systemd service definition for habitat-managed postgres
View postgresql94.service
Description=postgresql94 managed by habitat
bixu / postgres_replica.toml
Created Nov 1, 2016
Use Habitat to create a Postgres replica
View postgres_replica.toml
standby_mode = "on"
primary_conninfo_host = "postgres.primary.tld"
primary_conninfo_port = 5432
initdb_superuser_name = "postgres"
initdb_superuser_password = "password"
primary_conninfo_user = "postgres"
primary_conninfo_password = "password"
trigger_file = "/hab/svc/postgresql9.4/data/failover_trigger_file"
initdb_encoding = "en_US.UTF-8"
bixu /
Created Nov 1, 2016
Loading a custom `.toml` file into Habitat under your favorite service manager
HAB_POSTGRESQL94=$(cat /path/to/custom.toml) /usr/bin/hab start --no-color bixu/postgresql94
bixu / habitized_postgres
Last active Oct 7, 2016
postgres in the habitat studio
View habitized_postgres
HAB_POSTGRESQL='dynamic_shared_memory_type = "none"' hab start core/postgresql
View gist:c7f331959a45d9c9a75eb115a501dc4d
name: joyent
joyent_version: '~7.0'
joyent_username: <account name>
joyent_keyfile: <path to private ssh key>
joyent_keyname: <ssh key "name" in your Joyent account>