Skip to content

Instantly share code, notes, and snippets.

jpluscplusm / dec2ip.awk
Created Feb 5, 2020
AWK IPv4 to/from decimal
View dec2ip.awk
# 1-liner: awk '{for(i=0;i<4;i++){byte=$1%256;ip="." byte ip;$1-=byte;$1/=256}}END{sub(".","",ip);print ip}'
for(i=0; i<4; i++) {
byte = $1 % 256
ip = "." byte ip
$1 -= byte
$1 /= 256
jpluscplusm /
Created Dec 3, 2019
Shell log formatter with increment/decrement indentation thingy
#!/usr/bin/env bash
set -ueo pipefail
outofbandlogstring="This string must NEVER appear in the script's stdout/err ..." # or, like, simply "§" ...
function enter() {
echo "$@"
echo "${outofbandlogstring}+2"
jpluscplusm / vpnc-script-aws
Last active Jul 12, 2018 — forked from alext/vpnc-script-aws
vpnc script to route all AWS IP ranges over VPN.
View vpnc-script-aws
# vpnc-script wrapper for use with openconnect that routes all AWS IP ranges over the VPN.
# Pass any additional IP ranges to be routed as args to the script.
# Requirements: bash, curl and jq.
# Example usage:
# openconnect --script '/path/to/vpnc-script-aws'
jpluscplusm /
Created Jul 13, 2017
Dagnammit, Terraform
resource "aws_instance" "instance" {
ami = "ami-32rrg4334f"
instance_type = "t2.small"
subnet_id = "subnet-abc123dasf"
key_name = "key"
associate_public_ip_address = false
vpc_security_group_ids = [
jpluscplusm / test.bats
Last active Jul 22, 2017
Per-file setup/teardown support for BATS
View test.bats
setup() {
# Global setup
if [ $BATS_TEST_NUMBER -eq 1 ]; then
echo export FOO=bar
} >${BATS_TMPDIR}/bats.import.$PPID
. ${BATS_TMPDIR}/bats.import.$PPID
# Per-test setup as per documentation
jpluscplusm / .gitignore
Last active Sep 17, 2016
Terraform Makefile wrapper with remote state mgmt/bootstrap
View .gitignore
jpluscplusm / awk-ad
Last active Aug 22, 2016
AWK invocations for ASCII-delimited operation
View awk-ad
# ASCII-delimited input and output
awk -vFS="\x1F" -vRS="\x1E" -vOFS="\x1F" -vORS="\x1E" "$@"
jpluscplusm /
Created May 9, 2016 — forked from maxvt/
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

jpluscplusm /
Created Apr 29, 2016 — forked from lusis/
Docker "Best Practices"

This is a copy/paste from an internal wiki on how we should use docker

This guide is to serve as an outline of internal best practices to using Docker. The idea is to give enough information to allow engineers to create containers for new stack components while minimizing the cleanup required to make them production ready.


Before we get to the practices, it's important to understand WHY we are doing this. The key concepts we're concerned about with broad Docker usage are provenance, determinism, repeatability and auditability.


Provenance refers to knowing WHERE something comes from. Generally with the end use of software, this is easy:

  • Maven artifacts are pulled from central
You can’t perform that action at this time.