Skip to content

Instantly share code, notes, and snippets.

@bahamat
bahamat / docker-debug
Created January 22, 2020 20:02
Raw docker test utility
#!/bin/bash -x
set -o pipefail
api_v="1.21"
call_docker() {
local uuid=$(uuid)
/opt/pkg/bin/curl -k -si \
--cert ${DOCKER_CERT_PATH}/cert.pem \
@bahamat
bahamat / nginx-adminui.conf
Created January 22, 2020 17:30
nginx reverse proxy for adminui
# include this file from nginx.conf inside the http stanza.
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name adminui.example.com;
access_log /var/log/nginx/adminui.access.log bunyan;
error_log /var/log/nginx/adminui.error.log;
@bahamat
bahamat / from_node-triton_cli.md
Created October 11, 2019 17:01
Example for setting up CLOUDAPI_SERVICES sapi metadata
> triton -p west1 services
NAME    ENDPOINT
cmon    https://cmon.us-west-1.triton.zone:9163
docker  tcp://us-west-1.docker.joyent.com:2376
> triton -p west1 services -j
{"docker":"tcp://us-west-1.docker.joyent.com:2376","cmon":"https://cmon.us-west-1.triton.zone:9163"}
> triton -p west1 services -j | json
{
 "docker": "tcp://us-west-1.docker.joyent.com:2376",
@bahamat
bahamat / dnsupdate.py
Created July 27, 2019 09:09 — forked from pklaus/dnsupdate.py
dnsupdate is meant to replace nsupdate, the standard DDNS update tool created by BIND authors ISC. While nsupdate does the job it is awkward to wrap in scripts and its usage in general is just not very intuitive. dnsupdate is meant to work well from the command line or from scripts and easy to use. It also does some nice things like automaticall…
#!/usr/bin/env python2.7
# Matt's DNS management tool
# Manage DNS using DDNS features
#
# See http://planetfoo.org/blog/archive/2012/01/24/a-better-nsupdate/
#
# Usage: dnsupdate -s server -k key -t ttl add _minecraft._tcp.mc.example.com SRV 0 0 25566 mc.example.com.
# -h HELP!
# -s the server
# -k the key
@bahamat
bahamat / triton-grafana.json
Created July 16, 2019 19:44
Grafana dashboard template for Triton
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
NAME STATE READ WRITE CKSUM
zones ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c10t01d0 ONLINE 0 0 0
c11t01d0 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
c1t05d0 ONLINE 0 0 0
c2t0Dd0 ONLINE 0 0 0
mirror-2 ONLINE 0 0 0
c3t09d0 ONLINE 0 0 0
@bahamat
bahamat / auto_homedir
Created November 17, 2018 19:51
auto_homedir for use with illumos autofs to create user home directories on first access
#!/bin/bash
# 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 http://mozilla.org/MPL/2.0/.
#
# Copyright 2018 Brian Bennett <brian.bennett@joyent.com>
# Inspired by
# http://znogger.blogspot.com/2010/05/solaris-automatic-creation-of-home-dirs.html
@bahamat
bahamat / flask_example.md
Created July 25, 2017 05:09
Simple flask example.
@bahamat
bahamat / pipasswd
Last active July 29, 2020 15:29
pipasswd - Get the default root password for platform images installed in Triton
#!/bin/bash
set -o errexit
set -o pipefail
if [[ -n "$TRACE" ]]; then
export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -o xtrace
fi
@bahamat
bahamat / pkgsrc-brew.md
Created May 22, 2017 23:45
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)[simsong/tcpflow#91])