Skip to content

Instantly share code, notes, and snippets.

Saving the 🌏!

Matthew Hartstonge matthewhartstonge

Saving the 🌏!
  • Christchurch, New Zealand
Block or report user

Report or block matthewhartstonge

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
View configGitforGpg.bat
REM If you haven't globally set up git, ensure your git is the same as the email used for your signing key.
REM git config --global My Name
REM git config --global
git config --global user.signingkey Y0UR51GN1NGK3Y
git config --global commit.gpgsign true
git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
matthewhartstonge / release.ps1
Last active Oct 13, 2017
Cross-compile and package Go applications via Windows
View release.ps1
# Enables simple cross-compilation and packaging of Go applications via Windows.
# Author: Matthew Hartstonge
# Written: 2017-10-12
# Creates binaries packaged and ready to go in a distibution folder
function main() {
$operatingSystems = ("windows", "darwin", "linux", "openbsd", "freebsd", "solaris")
$architechtures = ("386", "amd64")
matthewhartstonge / httpstatus.proto
Last active Sep 2, 2019
HTTP Status Codes as protobuf/gRPC enums
View httpstatus.proto
// HTTPStatusCode provides all the known HTTP status codes. Since these codes
// are well known, it makes sense to use them as an easy way to detect, over
// the wire, if a message has been malformed, errors have happened or processed
// correctly.
enum StatusCode {
StatusCode_UNSPECIFIED = 0;
StatusCode_CONTINUE = 100;
StatusCode_PROCESSING = 102;
matthewhartstonge / timezones.proto
Created Jul 14, 2017
timezones as protobuf/gRPC enums
View timezones.proto
syntax = "proto3";
package tz;
enum TimeZone {
Utc0000 = 0; // (UTC+-0:00) Coordinated Universal Time.
UtcMinus1200InternationalDateLineWest = 1; // (UTC-12:00) International Date Line West
UtcMinus1100MidwayIsland_Samoa = 2; // (UTC-11:00) Midway Island, Samoa
UtcMinus1000Hawaii = 3; // (UTC-10:00) Hawaii
UtcMinus0900Alaska = 4; // (UTC-09:00) Alaska
UtcMinus0800PacificTime = 5; // (UTC-08:00) Pacific Time (US & Canada)
matthewhartstonge / forceMongoMaster.js
Last active Apr 9, 2017
Start Mongo Replicaset up again after hard power off or restarting all hosts or containers
View forceMongoMaster.js
* This script forces the first node in the config list to be master
cfg = rs.conf()
cfg.members[0].priority = 1
cfg.members[1].priority = 0.5
cfg.members[2].priority = 0.5
rs.reconfig(cfg, {force: true})
matthewhartstonge /
Last active Oct 11, 2016
Ubuntu 14.04LTS Docker Installation Script
#!/usr/bin/env bash
# Ubuntu 14.04LTS Docker Installation Script
# Maintainer: Matt Hartstonge <>
# Description:
# Checks that your kernel version is up to scratch, otherwise prints errors.
# If Kernel is all good, will go ahead and do an automated install.
matthewhartstonge / bootstrap-nav-profile-pic.css
Last active Dec 21, 2018
Bootstrap 3 Navbar Profile CSS with HTML Example
View bootstrap-nav-profile-pic.css
/* Bootstrap 3 Navbar Profile Picture CSS
* The CSS for profile pictures in the navbar has always annoyed me,
* so here's my fix that appears to have the least hoops.
* Production use:
* >Add a div with the specified class.
* >Using JS, change the profile picture CSS URL as needed.
* HTML example:
You can’t perform that action at this time.