Skip to content

Instantly share code, notes, and snippets.

View bixu's full-sized avatar
🦎

Blake Irvin bixu

🦎
  • Berlin
  • 01:12 (UTC +01:00)
View GitHub Profile
@bixu
bixu / banana-strap.sh
Last active July 11, 2018 15:52
python & machine learning on bananapi
#!/bin/bash
# execute this script directly by piping to your shell from `curl` like this:
# curl --silent https://gist.githubusercontent.com/bixu/1033ed8954fafea48f2f7b3f32faf1fe/raw/banana-strap.sh | sudo bash
set -e
echo "Setting up $(hostname)..."
apt-get update
@bixu
bixu / services_cli.md
Last active June 7, 2018 17:31
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 
@bixu
bixu / module_vendoring.md
Last active February 28, 2018 16:27
vendoring Python modules with Habitat

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

pkg_origin="bixu"
pkg_name="${PWD##*/}" # use the name of the directory containing our `plan.sh` to get the `pip` module name
pkg_bin_dirs=(bin)
pkg_lib_dirs=(lib)

# libs commonly needed during Python module installs:
@bixu
bixu / triton_quickstart.sh
Last active October 6, 2017 09:42
get shell in triton in about 30 seconds
#!/bin/bash
set -ex
# This assumes you have a Triton account
# (see http://lpage.joyent.com/Triton-Free-Trial.html)
# 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

or

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
bixu / postgresql94.service
Created November 1, 2016 08:38
systemd service definition for habitat-managed postgres
[Unit]
Description=postgresql94 managed by habitat
[Service]
Restart=always
ExecStart=/path/to/postgresql94.sh
[Install]
WantedBy=default.target
@bixu
bixu / postgres_replica.toml
Created November 1, 2016 08:22
Use Habitat to create a Postgres replica
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
bixu / postgresql94.sh
Created November 1, 2016 08:19
Loading a custom `.toml` file into Habitat under your favorite service manager
#!/bin/sh
HAB_POSTGRESQL94=$(cat /path/to/custom.toml) /usr/bin/hab start --no-color bixu/postgresql94
@bixu
bixu / habitized_postgres
Last active October 7, 2016 18:26
postgres in the habitat studio
HAB_POSTGRESQL='dynamic_shared_memory_type = "none"' hab start core/postgresql
@bixu
bixu / gist:c7f331959a45d9c9a75eb115a501dc4d
Created August 23, 2016 09:54
test kitchen in joyent
---
driver:
name: joyent
driver_config:
joyent_version: '~7.0'
joyent_username: <account name>
joyent_keyfile: <path to private ssh key>
joyent_keyname: <ssh key "name" in your Joyent account>
joyent_url: https://us-east-1.api.joyent.com