Skip to content

Instantly share code, notes, and snippets.

Avatar
🐤
Bippity boppity boom

Noel Cower nilium

🐤
Bippity boppity boom
View GitHub Profile
@nilium
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
-h|--help)
echo 'Usage: jsonkv [-h|--help] [--] KEY VALUE...' 1>&2
exit 2
;;
--)
shift
;;
esac
@nilium
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
}
LIST_MODE=true
LOOKUP_HOST=
@nilium
nilium / 1p-NOTICE.md
Last active Jan 12, 2019
A CLI tool to fuzzy-find 1Password vault items and copy / format them.
@nilium
nilium / fup
Last active Jan 6, 2019
Short script to upload a file to a GCS bucket and print its public URL
View fup
#!/usr/bin/env bash
prog="$(basename "$0")"
## Defaults
# : ${FUP_BUCKET:=YOUR-BUCKET}
# : ${FUP_URL_PREFIX:=https://CUSTOM-URL/}
: ${FUP_PAR_UPLOAD_THRESHOLD:=100M}
: ${FUP_URL_PREFIX:=https://storage.googleapis.com/${FUP_BUCKET}/}
View messages.go
// This is an example message reader/writer with length prefixes and digests
// (in the example's case, using hmac-sha1) to try to confirm that the entire
// correct message was read.
package main
import (
"bytes"
"crypto/hmac"
"crypto/sha1"
View keybase.md

Keybase proof

I hereby claim:

  • I am nilium on github.
  • I am nilium (https://keybase.io/nilium) on keybase.
  • I have a public key ASA9ZYQ-ovUYaqBiWNB9MPYWyy-cDcIQZym8orvks3qGvAo

To claim this, I am signing this object:

View zshasum
#!/usr/bin/env bash
args=()
while [ $# -gt 0 ]; do
case "$1" in
--) shift; break;;
-?*) :;;
-) break;;
*) break;;
esac
@nilium
nilium / agentr
Last active Aug 31, 2018
Lazy script to run ag and entr in conjunction with a series of commands.
View agentr
#!/usr/bin/env bash
prog="$(basename "$0")"
want() {
for bin; do
if ! hash "$bin" 1>/dev/null 2>&1; then
echo "$bin: not installed" 1>&2
exit 1
fi
@nilium
nilium / codf.md
Last active Jul 9, 2018
Codf rationale draft 2
View codf.md

Codf exists primarily to make expressive, structured configuration easy to use. Expressive in this case means, more or less, relatively complex but easy to read and write. There are cases of progams like this in the wild, such as nginx, where configuration is integral to making use of them. Codf takes inspiration from nginx in particular, along with other curly-braced config languages. The goal is to provide structure for programs where the status quo of JSON-equivalent languages do not.

With that in mind, codf is the result of several years of building programs that require configuration to define their runtime behavior. This includes several programs whose configuration borders on scripting. These programs need configuration not only for inputs (sockets, files, DBs) and outputs (metrics, logs, more DBs), but also tasks, schedules, data pipelines, state transitions, and so on. Without these, the programs are mostly inert and do nothing — this makes configuration crucial to

@nilium
nilium / codf.md
Last active Jul 8, 2018
Codf rationale draft
View codf.md

Codf

codf (godoc) is a personal config language for declaring structured config files with support for a range of built-in types. It's meant to scratch an itch I've had over configuration in Go programs for some time.

You can’t perform that action at this time.