Skip to content

Instantly share code, notes, and snippets.

stephen-mw /
Last active August 22, 2023 03:55
Install python3.8 and make the system default on Raspberry Pi
#!/usr/bin/env bash
set -euo pipefail
# This script downloads, compiles, and installs python3.8 as the system default
export VERSION=3.8.5
apt install -y \
build-essential \
libbz2-dev \
stephen-mw / go_null_json_example.go
Last active November 22, 2022 13:28
Golang http server with sql null values and json
package main
import (
_ ""

Keybase proof

I hereby claim:

  • I am stephen-mw on github.
  • I am stephenmw ( on keybase.
  • I have a public key whose fingerprint is 02A1 A27C E45C 503C 84A9 E9AA 924B A05C D817 8DC7

To claim this, I am signing this object:

stephen-mw /
Created June 15, 2016 18:07
Linux/Bash get the epoch linux time in milliseconds
# If you don't care too much about the granularity, just multiply by 1000 :-)
echo $((`date +%s` * 1000))
stephen-mw / ec2list.go
Last active December 14, 2017 01:38
Ec2 list in go
package main
import (
apt-get update -y
aptitude install -y build-essential
wget ""
tar -zxf ./ixgbevf-*
cd ixgbevf*/src
make install
modprobe ixgbevf
sudo update-initramfs -c -k all
echo "options ixgbevf InterruptThrottleRate=1,1,1,1,1,1,1,1" > /etc/modprobe.d/ixgbevf.conf
stephen-mw /
Last active April 18, 2022 16:07
List running EC2 instances with golang and aws-sdk-go

This is the beginning of hopefully many new posts with golang snippets from my blog. List all of your running (or pending) EC2 instances with Amazon's golang sdk.

For a list of filters or instance attributes consult the official documentation.

package main

import (
stephen-mw / pre-push
Last active September 9, 2021 01:35 — forked from pixelhandler/
pre-push hook to prevent pushing to dev, prod, release-*, patch-*
# Prevents force-pushing to master
BRANCH=`git rev-parse --abbrev-ref HEAD`
PUSH_COMMAND=`ps -ocommand= -p $PPID`
echo "Prevented force-push to protected branch \"$BRANCH\" by pre-push hook"
stephen-mw / The_Deployment_Manifesto
Created March 4, 2014 21:05
The Deployment Manifesto
The 10 Tenets of Deployments
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
"OPTIONAL" in this document are to be interpreted as described in
[RFC 2119](
1. Configuration management MUST NOT be coupled to an external service, such as EC2, Openstack, Foreman, or anything else.
2. Devops SHOULD provide a self-service framework for the automatic creation and destruction of hosts from the ground up.
stephen-mw / easy_bash_colors
Created January 25, 2014 04:13
Easy bash colors
color() {
echo -e "\033[0;$1m$2\033[0m"
echo_red() {
color 31 "$1"
echo_green() {
color 32 "$1"
echo_yellow() {