Skip to content

Instantly share code, notes, and snippets.

View brianonn's full-sized avatar

Brian Onn brianonn

  • Vancouver, Canada
View GitHub Profile
@brianonn
brianonn / sleep.yaml
Created April 23, 2022 00:44
Simple sleep pod running busybox
apiVersion: v1
kind: Pod
metadata:
name: sleep
spec:
containers:
- name: sleep
image: busybox:latest
# Just spin & wait forever
command: [ "/bin/sh", "-c", "--" ]
@brianonn
brianonn / Vagrantfile
Created April 5, 2022 07:50
vagrant debian/buster64 with docker
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/buster64"
config.vm.hostname = "docker-host"
config.vm.define "docker-host"
config.vagrant.plugins = ['vagrant-vbguest']
config.vm.provider "virtualbox" do |vb|
@brianonn
brianonn / setup_iptables.sh
Created March 8, 2021 06:50
Setup iptables for a new client only host. Allows SSH in, DNS queries, NTP and outbound to HTTP and HTTPS only.
#!/bin/sh
# flush and delete all existing rules and chains
iptables -t filter -F
iptables -t nat -F
iptables -t mangle -F
iptables -F
iptables -t filter -X
iptables -t nat -X
iptables -t mangle -X
@brianonn
brianonn / multi-vagrant.sh
Created September 13, 2020 23:43
run a command on multiple OS'es via Vagrant on Virtualbox
#!/bin/bash
CMD="${1:-ls -l /}"
BOXES="${2:-centos/8 generic/ubuntu1804}"
PROVIDER="${3:-virtualbox}"
LOG="$PWD/commands.log"
: > "$LOG"
TMPDIR="/tmp/$RANDOM.$$"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Config Github Settings
github_username = "fideloper"
github_repo = "Vaprobash"
github_branch = "1.4.0"
github_url = "https://raw.githubusercontent.com/#{github_username}/#{github_repo}/#{github_branch}"
# Because this:https://developer.github.com/changes/2014-12-08-removing-authorizations-token/
@brianonn
brianonn / wireless-link-bonding.sh
Created June 20, 2020 03:14 — forked from braian87b/wireless-link-bonding.sh
Linux Interface Bonding on Wireless Link (OpenWrt / LEDE)
@brianonn
brianonn / testWithCapture.go
Created May 21, 2020 22:18
Run Golang tests, capturing the Uber zap() output to a memory buffer
testwithcapture.go
// testWithCapturedZapOutput runs a test and captures zap.L() outputs
func testWithCapturedZapOutput(testToRun func(t *testing.T), t *testing.T) string {
var buffer bytes.Buffer
origLogger := zap.L()
defer func() {
zap.L().Sync()
zap.ReplaceGlobals(origLogger)
@brianonn
brianonn / helm_tls_wrapper.sh
Created October 2, 2019 12:17
TLS wrapper for helm
#!/usr/bin/env bash
#
# this script is a helpful wrapper for Helm CLI, when using TLS enabled Tiller
# See https://github.com/helm/helm/blob/master/docs/tiller_ssl.md
#
# Copyright (C) 2019 Anastas Dancha (aka @anapsix)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
@brianonn
brianonn / smpte test
Last active June 30, 2019 05:48
make a SMPTE color test pattern
pulsesink for Pulseaudio output
alsasink for ALSA output
osssink and oss4sink for OSS/OSSv4 output
jackaudiosink for JACK output
gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink