View awk_prefix_seconds_elapsed.md
( for i in $(seq 1 5); do echo $i ; sleep $i ; done ) \
| gawk 'BEGIN { since = systime() } { printf "%-7s", (systime() - since) "s" ; print }'

Output:

View set_or_append_java_config.sh
function set_or_append_java_config() {
local FILE=$1
local KEY=$2
local VALUE=$3
if grep -q "^${KEY}=" "${FILE}"; then
sed -i -e "s#^\\(${KEY}=\\).*"'$'"#\\1${VALUE}#" "${FILE}"
else
echo "${KEY}=${VALUE}" >> "${FILE}"
fi
View install-nodejs.sh
#!/usr/bin/env bash
##
# Description:
#
# Automatically installs and configures node.js.
#
if ! [[ "$(id -u)" = '0' ]] ; then
echo "\"$0\" must be run as root" 1>&2
View delete-from-v2-docker-registry.md

One liner for deleting images from a v2 docker registry

Just plug in your own values for registry and repo/image name.

registry='localhost:5000'
name='my-image'
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$(
    curl -sSL -I \
        -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
View install-oracle-jdk.sh
#!/usr/bin/env bash
##
# Description:
#
# Automatically installs and configures Oracle JDK on Centos, OEL6, and OEL7.
#
if ! [[ "$(id -u)" = '0' ]] ; then
echo "\"$0\" must be run as root" 1>&2
View main.go
package main
import (
"context"
"flag"
"fmt"
"os"
"path/filepath"
"regexp"
"sync"
View kubernetes_k8s_cheatsheet_notes.md

Jay's Kubernetes K8s Cheatsheet Notes

Taints and tolerations

taints.tpl:

{{printf "%-50s %-12s\n" "Node" "Taint"}}
{{- range .items}}
    {{- if $taint := (index .spec "taints") }}
View aws-network-troubleshooting.md

Check a route path:

Start a container in --net=routed mode:

sudo docker run --rm -it --net=routed --ip-address=10.241.9.10 centos

vethrb31af40 = container network interface obtained from ip route output.

View react-unexpected-use-of-location.md
React: Unexpected use of 'location';

Solution: Use window.location instead of bare location.

View zookeeper-cleaner.sh
#!/usr/bin/env bash
##
# Useful reference and documentation material:
#
# https://zookeeper.apache.org/doc/r3.3.2/zookeeperAdmin.html#Ongoing+Data+Directory+Cleanup
set -o errexit
set -o pipefail
set -o nounset