Skip to content

Instantly share code, notes, and snippets.

@LadyNamedLaura
LadyNamedLaura / ipcalc.sh
Created May 24, 2016 14:21
ipcalc with bash
#!/bin/bash
nuls='00000000000000000000000000000000'
ones='11111111111111111111111111111111'
if [ -n "$2" ]
then
varprefix=${2}_
fi
ip=( $( echo $1 | sed 's/[.\/]/ /g') )
#!/bin/bash
log(){
echo $@ 1>&2
}
job="encrypt"
outfile="/dev/stdout"
privatekey="$HOME/.ssh/id_rsa"
#!/bin/bash
MYDIR="${HOME}/.worklog"
mkdir -p "${MYDIR}"
cd "${MYDIR}"
LOGNAME="$(date '+%x').log"
touch "${LOGNAME}"
@LadyNamedLaura
LadyNamedLaura / plot_latency.sh
Created January 19, 2017 16:00
little website latency test script
#!/bin/bash
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
export LC_ALL=C
urls=("$@")
data="$(mktemp)"
exec 5> >(gnuplot)
@LadyNamedLaura
LadyNamedLaura / update_fixtures.rb
Created November 21, 2018 14:10
update_fixtures.rb
require 'yaml'
require 'json'
require 'pathname'
require 'digest/sha1'
require 'optparse'
require 'ostruct'
options = OpenStruct.new
options.from_metadata = false
@LadyNamedLaura
LadyNamedLaura / forge_to_git.sh
Created May 13, 2019 08:09
convert forge modules into git modules
cat Puppetfile | tr '\n' '|' | sed 's_,|_, _g' | tr '|' '\n' | sed -n
's_^\s*mod\s\+'"'"'\(\S*\)'"'"'\s*,\s*'"'"'\(\S*\)'"'"'\s*$_\1\t\2_p' |
sed 's_/_-_' | while read modname version
do
sourceurl="$(curl -s
"https://forgeapi.puppet.com/v3/modules/${modname}" | jq -r
'.current_release.metadata.source')"
tag="$(git ls-remote --tags "${sourceurl}" | cut -f2 | grep
"^refs/tags/v\?${version}\$")"
[ -n "${tag}" ] && echo -e "\nmod '${modname}',\n :git =>