This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Creates clones of HyperV virtual machines | |
# Author: Aaron Gießelmann | |
# Date: 22-10-14 | |
function die { | |
$_.Exception | |
exitwait 1 | |
} | |
function exitwait { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
mapfile -t words < <(grep -x '[a-z]\{5\}' "${WORDLIST:-/usr/share/dict/words}") | |
word=${words[RANDOM % ${#words[@]}]} pool=abcdefghijklmnopqrstuvwxyz | |
for ((round=1; round <= ${ROUNDS:=6}; round++)); do | |
while read -rp "$round/$ROUNDS: " guess || exit 1; do | |
[[ " ${words[@]} " == *" ${guess,,} "* ]] && guess=${guess,,} && break | |
done | |
for ((i=0, chars=0; i < ${#word}; i++)); do | |
[[ ${word:i:1} != ${guess:i:1} ]] && chars+=${word:i:1} | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
esc() { | |
printf '\033%s' "$@" >&2 | |
} | |
clean_exit() { | |
_exit_status=$? | |
trap - EXIT | |
# Show cursor again. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -ef | |
main() { | |
trap 'kill 0' EXIT HUP INT | |
emitter | collector | |
} | |
# All variables used here are dynamically assigned via `export`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
prog_name=${0##*/} | |
version=1.0 | |
version_text="Boilerplate for new scripts v$version" | |
options="h o: q v V" | |
help_text="Usage: $prog_name [-o <text>] [-hqvV] [<file>]... | |
Boilerplate for new scripts |