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 / gomodgraph
Created Mar 20, 2019
Tool to generate graphs of Go module dependencies
View gomodgraph
#!/usr/bin/env bash
# Based on
case "$1" in
nilium / Dockerfile
Last active Feb 18, 2019
Dockerfile to cross-compile Go binaries for a target platform and produce a Docker image for the target platform
View Dockerfile
# Dockerfile to cross-compile Go binaries for a target platform
# Usage:
# $ docker build --platform linux/arm .
# Cross-compile package for target platform from build platform
FROM --platform=${BUILDPLATFORM} golang:1-alpine AS build
ADD . /tmp/go
WORKDIR /tmp/go
nilium / GNUmakefile
Created Jan 19, 2019
Terraform makefiles (bmake, gmake)
View GNUmakefile
TF_MODULES := $(shell find . -type f -iname '*.tf')
.PHONY: all plan apply
all: plan
plan: tf.plan
apply: tf.plan
terraform apply $<
nilium / docker-ports
Last active Jan 3, 2019
Script to display docker containers with exposed / bound ports in dzen2
View docker-ports
#!/usr/bin/env bash
# Usage: docker-ports [format] <dzen2-args...>
# Displays open docker ports using dzen2.
# Example:
# $ docker-ports -fn 'PragmataPro-9' -dock
format_ports() {
nilium / kv
Last active Dec 28, 2018
A few shell scripts for creating JSON from a shell
View kv
#!/usr/bin/env bash
while [ $# -gt 0 ]; do
jq -nc --arg k "$1" --arg v "$2" '{($k): (try ($v|fromjson) catch $v)}'
shift; shift
done | jq -sc add
nilium / serial.vim
Created Dec 27, 2018
Vim plugin to write/update a serial number comment
View serial.vim
" serial.vim
" Noel Cower
" Plugin to insert serial strings based on a local timestamp.
" For example:
" Serial 20181227100403
" The above is this file's serial, inserted using :SerialUpdate. It can
" be updated with subsequent calls to :SerialUpdate. You can create
View Updated version of the old git-wordiness script
# FIXME: Names with non-ASCII characters can throw-off alignment of columns.
usage() {
cat <<HELPTXT 1>&2
git-wordiness [OPTIONS]
List general sums about commit messages (i.e., wc output).
View git-mr
#!/usr/bin/env bash
# Copyright 2018 Noel Cower
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
nilium / jsonkv
Created Dec 20, 2018
Short bash script to create a JSON object from a sequence of key-value arguments
View jsonkv
#!/usr/bin/env bash
case "$1" in
echo 'Usage: jsonkv [-h|--help] [--] KEY VALUE...' 1>&2
exit 2
nilium / gce-inventory
Last active Mar 18, 2019
Ansible dynamic inventory script to pull GCE hosts
View gce-inventory
#!/usr/bin/env bash
set -e
usage() {
echo 'Usage: gce-inventory [--help|--list|--host HOSTNAME]' 1>&2
You can’t perform that action at this time.