Skip to content

Instantly share code, notes, and snippets.

Breaking things

Noel Cower nilium

Breaking things
Block or report user

Report or block nilium

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
nilium / consul.diff
Created Aug 13, 2019
Diff of Consul v1.5.3 between versions of the same tag
View consul.diff
v1 is the original v1.5.3 tag, v2 is the changed v1.5.3 tag.
diff -U2 -r v1/consul-1.5.3/vendor/ v2/consul-1.5.3/vendor/
--- v1/consul-1.5.3/vendor/ 2019-07-25 16:41:17.000000000 -0700
+++ v2/consul-1.5.3/vendor/ 2019-07-25 16:41:17.000000000 -0700
@@ -56,5 +56,5 @@
// companion .gitattributes file containing 'export-subst' in this same
// directory. See also
- gitVersion string = "v0.0.0-master+a42ded477c"
+ gitVersion string = "v0.0.0-master+a42ded477"
nilium / nomad-tweak
Created Aug 11, 2019
Bash script and jq module to make it easier to make small adjustments to Nomad jobs
View nomad-tweak
#!/usr/bin/env bash
# Copyright Noel Cower 2019.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# Usage: nomad-tweak <job> [options...] <jq-script>
# Options:
# -A, --apply
nilium / withtemp
Last active Aug 10, 2019
Script to generate an eval-able line to create a temporary file, assign it to a variable, and remove it upon exit.
View withtemp
# Usage: eval "$(withtemp [varname [mktempargs]])
# If varname is given, a tempfile is generated, its path assigned to the
# variable $varname, and deleted upon exit. Otherwise, no varname
# becomes 'tempfile' and no arguments are passed to mktemp. Varname is
# not exported or local, but you may evaluate using either
# $ eval "local $(withtemp ...)"
nilium / twitter.json
Created Jul 23, 2019
Twitter init-data
View twitter.json
"keyboardShortcuts": [
"name": "Actions",
"description": "Shortcuts for common actions.",
"shortcuts": [
"keys": [
nilium / main.go
Last active Jun 14, 2019
Example of parsing environment variables and CLI flags using the flag package
View main.go
package main
import (

Build server notes

Any use of "we" in this document is the authorial we because using "I" sounds weird. This is intended to cover building packages under spiff-packages and not necessarily supporting the entirety of void-packages (due to size, complexity, and not having a good idea of every weird quirk of every package in it).

All jobs are intended to run using parametrized nomad tasks. This is not necessarily a requirement but is how it's planned out for now due to the homelab setup.

When building a package, we first need to request a list of all dependencies that package has and fetch all of them

If any package is not already in either the main or build repo, we need to build it, so we have to submit additional jobs to build those packages.

nilium / git-instat
Last active May 20, 2019
Git script to scan diff --numstat output and sum it.
View git-instat
usage() {
cat >&2 <<-'EOF'
Usage: git-instat [range] [path...] [-path pattern...] [-only pattern...] [-omit pattern...]
Print a stat summary for the given paths in a ref.
If no range is given, the default is 'HEAD^1..HEAD'.
-only and -omit may be passed to filter lines of the numstat, such that
nilium / gomodver
Created Apr 12, 2019
Script to print Go module v0.0.0-DATE-SHA version strings
View gomodver
# Usage: gomodver [REF...]
# Prints a Go modules v0.0.0-DATE-SHA version string for the given Git refs.
# If no REF is given, gomodver defaults to HEAD.
case "$(uname -s | tr A-Z a-z)" in
*bsd|darwin) datearg=r;
nilium / lssrc
Created Mar 27, 2019
Short script to list all non-stdlib sources used by a Go package
View lssrc
#!/usr/bin/env bash
comm -23 \
<(go list -f '{{.ImportPath}}{{"\n"}}{{range .Deps}}{{.}}{{"\n"}}{{end}}' "$@" | sort | uniq) \
<(go list std | sort) |
xargs go list -f '{{$dir := .Dir}}{{range .GoFiles}}{{$dir}}/{{.}}{{"\n"}}{{end}}' |
sort | uniq
nilium / gen-go-test-stubs
Created Mar 21, 2019
Script to generate stub_test.go files for any package without tests to produce 0% coverage for those packages
View gen-go-test-stubs
#!/usr/bin/env bash
gen_stub() {
set -e
local pkg="$1"
local pkgdir="$(go list -f '{{.Dir}}' "$pkg")"
local pkgname="$(go list -f '{{.Name}}' "$pkg")"
local stub="$pkgdir/stub_test.go"
if [ -e "$stub" ]; then
echo "# Cannot create $stub: file already exists" >&2
return 1
You can’t perform that action at this time.