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 check_pathmtime.sh
#!/usr/bin/env bash
##
# @author Jay Taylor [@jtaylor]
#
# @date 2012-10-30
#
# @description Nagios NRPE plugin: Check the number of seconds since a file
# or directory was last modified.
#
View timeout.sh
#
# Mac OS-X does not come with the delightfully useful `timeout` program. Thankfully a rough BASH equivalent can be achieved with only 2 perl statements.
#
# Originally found on SO: http://stackoverflow.com/questions/601543/command-line-command-to-auto-kill-a-command-after-a-certain-amount-of-time
#
function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
## Example usage:
#
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 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
View camel_case_to_snake_case.py
#!/usr/bin/env python
"""
Convert camel-case to snake-case in python.
e.g.: CamelCase -> snake_case
Relevant StackOverflow question: http://stackoverflow.com/a/1176023/293064
"""
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 cf.sh
#!/usr/bin/env bash
##
# @author Jay Taylor [@jtaylor]
# @date 2013-08-15
#
# @description CloudFlare management script.
#
# Path ENV VAR override.
View gitmodules-sorter.md
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