Skip to content

Instantly share code, notes, and snippets.

Brian Bennett bahamat

Block or report user

Report or block bahamat

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
bahamat / manta-pipasswd
Last active Jun 14, 2018
Get the default root password for platform images installed in Triton (manta-pipasswd, triton-pipasswd, pipasswd)
View manta-pipasswd
# This will retrieve the default root password for platform images stored in Joyent's Manta service.
# Run this from your workstation.
# This only makes sense in the context of Joyent's cloud, because that's where the
# build artifacts are.
export MANTA_URL=
if [[ -n "$TRACE" ]]; then
bahamat /
Created May 22, 2017
Packages I get from brew instead of pkgsrc, and why
pkg why
dnstracer not available
fortune not available
ghc not available on mac
hping out of date (pkgsrc==hping2, brew==hping3)
nagios-plugins does not compile on mac. Maybe brew patch(es) can be used?
shunit2 not available
tcpflow out of date (pkgrsc==0.21, brew==1.4); depends on dfxml which does not compile on smartos due to missing MAP_FILE ([tcpflow#91)[])
bahamat /
Last active Oct 11, 2019
Shell script to pull CMON metrics from Joyent Triton (
if [[ -n "$TRACE" ]]; then
export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -o xtrace
call() {
curl "$insecure" "${header:--i}" -s --cert "$cert" --key "$key" "https://${1}/${2}"
exit $?
bahamat /
Last active Oct 23, 2019
How are various shells configured, and in which order?


login interactive files
N Y ~/.bashrc
Y N /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile
Y Y /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile
View triton-update-all
set -o errexit
set -o xtrace
imgadm vacuum -f
sdcadm update --all --just-images -y
sdcadm self-update --allow-major-update --latest
sdcadm dc-maint start && printf "DC maintenance has started at %s\n" "$(date)"
bahamat /
Last active Nov 1, 2019
Diagnosing "No Compute Resources Available" messages in Triton.

No Compute Resources Available

This error is somewhat ambiguious because there is seemingly no indication which resource is exhausted.

Triton chooses compute nodes with a subcomponent called sdc-designation (also refered to as , DAPI). The full DAPI log for a provision job is embedded in the CNAPI log file and can be extracted with the workflow job uuid and the following script.


if [[ -n "$TRACE" ]]; then                                                      
bahamat / nginx_log_format_bunyan.conf
Last active Sep 14, 2016
nginx log_format bunyan
View nginx_log_format_bunyan.conf
log_format bunyan '{'
'"name": "nginx/$nginx_version",'
'"hostname": "$hostname",'
'"pid": "$pid",'
'"level": 30,'
'"time": "$time_iso8601",'
'"v": 0,'
'"msg": "access",'
'"remoteAddress": "$remote_addr",'
bahamat /
Last active Nov 11, 2015
illumos SMF manifests for Cfengine.

Download each file using the Raw link, or clone this gist then run the following commands:

svccfg import cf-serverd.xml
svccfg import cf-monitord.xml
svcdfg import cf-execd.xml

In your policy, cfe_internal/update/ should be updated accordingly to enable the SMF services instead of executing commands directly.

# This little hack-job will grab credentials from a running openvpn process in Linux
# Keep in mind this won't work if the user used the --auth-nocache flag
grep rw-p /proc/$1/maps | sed -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p' | while read start stop; do gdb --batch-silent --silent --pid $1 -ex "dump memory $1-$start-$stop.dump 0x$start 0x$stop"; done
echo "Your credentials should be listed below as username/password"
strings *.dump | grep -B2 KnOQ | grep -v KnOQ
rm *.dump --force
View sdc-cn-comments
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at
# Copyright (c) 2015, Brian Bennett <>
cn=$1; shift
action=$1; shift
You can’t perform that action at this time.