Skip to content

Instantly share code, notes, and snippets.

@jpluscplusm
jpluscplusm / dec2ip.awk
Created Feb 5, 2020
AWK IPv4 to/from decimal
View dec2ip.awk
#!/usr/bin/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
jpluscplusm / log-indent-test.sh
Created Dec 3, 2019
Shell log formatter with increment/decrement indentation thingy
View log-indent-test.sh
#!/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"
}
View bosh-links-why-and-how.md
@jpluscplusm
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
#!/bin/bash
# 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 https://vpn.example.com/profile --script '/path/to/vpnc-script-aws'
#
@jpluscplusm
jpluscplusm / instance.tf
Created Jul 13, 2017
Dagnammit, Terraform
View instance.tf
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 = [
"${aws_security_group.1.id}",
@jpluscplusm
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
fi
. ${BATS_TMPDIR}/bats.import.$PPID
# Per-test setup as per documentation
@jpluscplusm
jpluscplusm / .gitignore
Last active Sep 17, 2016
Terraform Makefile wrapper with remote state mgmt/bootstrap
View .gitignore
/.terraform/terraform.tfstate*
/plan.out
/.plan.out.*
@jpluscplusm
jpluscplusm / awk-ad
Last active Aug 22, 2016
AWK invocations for ASCII-delimited operation
View awk-ad
#!/bin/bash
# ASCII-delimited input and output
awk -vFS="\x1F" -vRS="\x1E" -vOFS="\x1F" -vORS="\x1E" "$@"
@jpluscplusm
jpluscplusm / infra-secret-management-overview.md
Created May 9, 2016 — forked from maxvt/infra-secret-management-overview.md
Infrastructure Secret Management Software Overview
View infra-secret-management-overview.md

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
jpluscplusm / index.md
Created Apr 29, 2016 — forked from lusis/index.md
Docker "Best Practices"
View index.md

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.

Concepts

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

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.