Skip to content

Instantly share code, notes, and snippets.

View ae6rt's full-sized avatar

Mark Petrovich ae6rt

  • Petaluma, CA
View GitHub Profile
@ae6rt
ae6rt / tcng.md
Last active December 17, 2019 23:48
Building tcng

build

tcng is a higher level language around the Linux traffic shaping tool tc. Users craft a tcng specification, and compile that to an equivalent set of tc commands.

Reference: http://linux-ip.net/gl/tcng/node1.html

Do this in a debian container

apt-get update
@ae6rt
ae6rt / proxy.conf
Created July 28, 2017 00:27
kubernetes 1.7 kube-proxy config file
apiVersion: componentconfig/v1alpha1
kind: KubeProxyConfiguration
clientConnection:
kubeconfig: "/etc/kubernetes/kubeconfig"
hostnameOverride: "lxc016"
mode: "iptables"
@ae6rt
ae6rt / testtable.el
Created March 14, 2017 13:13
Go test table keyboard macro
;; keyboard macros
;; Go unit test table []struct{}{}
(fset 'testtable
(lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ("var tests = []struct{^M}{^M{},^M}^Mfor testNumber, test := range tests {} " 0 "%d")) arg)))
(global-set-key (kbd "C-x C-k 0") 'testtable)
@ae6rt
ae6rt / -
Created March 2, 2017 04:02 — forked from anonymous/-
System: Host: tp560 Kernel: 4.4.0-64-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.2.6 (Gtk 3.18.9-1ubuntu3.1) dm: mdm Distro: Linux Mint 18.1 Serena
Machine: System: LENOVO (portable) product: 20FHCTO1WW v: ThinkPad T560 Chassis: type: 10
Mobo: LENOVO model: 20FHCTO1WW v: SDK0J40709 WIN
Bios: LENOVO v: N1KET26W (1.13 ) date: 10/07/2016
CPU: Dual core Intel Core i7-6600U (-HT-MCP-) cache: 4096 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 11233
clock speeds: min/max: 400/3400 MHz 1: 532 MHz 2: 503 MHz 3: 520 MHz 4: 539 MHz
Graphics: Card: Intel Sky Lake Integrated Graphics bus-ID: 00:02.0 chip-ID: 8086:1916
Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa)
@ae6rt
ae6rt / aes-256-gcm.go
Created December 15, 2016 14:41 — forked from cannium/aes-256-gcm.go
golang aes-256-gcm
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/hex"
"fmt"
"io"
)
@ae6rt
ae6rt / prepare-commit-msg
Created December 9, 2016 21:02
Git prepare-commit hook to put branch name in commit message
#!/bin/sh
readonly TEMP_FILE=$(mktemp /tmp/commit-message-XXXX)
trap "rm -f ${TEMP_FILE}" EXIT
echo $(git rev-parse --abbrev-ref HEAD) > ${TEMP_FILE}
cat $1 >> ${TEMP_FILE}
mv ${TEMP_FILE} $1
@ae6rt
ae6rt / rabbit.md
Last active May 24, 2016 12:12
Clustering RabbitMQ in a pair of Docker containers

Command basics

NET=${NET:-rabbit-net}

# Create a network
docker network create -d bridge --subnet 172.25.0.0/16 $NET 

# Start containers 
docker rm -f rabbit1 rabbit2 >/dev/null 2>&1
@ae6rt
ae6rt / pretty_config.erl
Created May 22, 2016 15:59 — forked from lefant/pretty_config.erl
a little escript snippet to pretty print erlang config, using the erl_syntax module
#!/usr/bin/env escript
%% -*- erlang -*-
%% * slurp in terms using inlined version of kernels file:consult/1
%% * convert to abstract syntax tree
%% * annotate all tuples
%% * pretty print using a hook to prefix the annotated nodes with newline
main([]) ->
io:format("%% -*-erlang-*-~n"),
@ae6rt
ae6rt / gist:54c229caf7bc62bbe3bf
Created August 24, 2015 20:59
Cert testing with openssl
Verify you have good working certs with openssl.
Create your CA, and server cert and key.
In one terminal, playing the server role:
openssl s_server -accept 8443 -cert /usr/local/etc/rabbitmq/rabbitmq.pem -key /usr/local/etc/rabbitmq/rabbitmq-key.pem -CAfile /usr/local/etc/rabbitmq/ca.pem
In another terminal, playing the client
@ae6rt
ae6rt / gist:da66715b3d7b501a6900
Created August 9, 2015 22:44
kubeconfig that points to a CA cert
If you sign your own certificates that your Kube API Server uses, tell kubectl about your CA cert in your kubconfig file:
apiVersion: v1
clusters:
- cluster:
certificate-authority: /Users/mpetrovic/.kube/cacert.pem ## <<<<<<<<<<<<<<<<<
server: https://kube-inf-master1.dev.xoom.com:6443
name: aws_kubernetes-v1.0.1
contexts:
- context: