This file contains hidden or 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 | |
# Strict mode (see: http://redsymbol.net/articles/unofficial-bash-strict-mode/). | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Exit if not running as root. | |
if [ "$(id -u)" != "0" ]; then | |
>&2 echo "This script must be run as root." | |
exit 1 |
This file contains hidden or 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 | |
# Strict mode (see: http://redsymbol.net/articles/unofficial-bash-strict-mode/). | |
set -euo pipefail | |
IFS=$'\n\t' |
This file contains hidden or 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
clearInterval(window.shootInterval); | |
var targetComparator = function (a, b) { | |
var aDist = ig.game.player.distanceTo(a); | |
var bDist = ig.game.player.distanceTo(b); | |
return aDist - bDist; | |
}; | |
shootInterval = setInterval(function () { | |
if (!ig.game) { return; } |
This file contains hidden or 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 | |
# This script takes a list of words and turns it into a 10-sided-die version of a | |
# Diceware list. It: | |
# * Reads a list of words | |
# * Removes long words and those with non-ASCII characters, for ease-of-use | |
# * Randomly orders them | |
# * Takes the first 10,000 (for use with 10-sided dice) | |
# * Sorts them nicely | |
# * Numbers the lines appropriately |
This file contains hidden or 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 | |
# Strict mode (see: http://redsymbol.net/articles/unofficial-bash-strict-mode/). | |
set -euo pipefail | |
IFS=$'\n\t' | |
# We name the repository directory after the system's hostname and the current | |
# year/month. We include the year/month combo so our backup repository doesn't | |
# continue to grow forever, and we can manually delete old ones as necessary. | |
name="$(hostname)" |
This file contains hidden or 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 sh | |
# arguments | |
name="${1}" | |
src="${2}" | |
dest_dir="$(dirname "${3}/gets_removed")" | |
# validate arguments | |
if [ -z "${name}" ]; then | |
echo "Invalid backup name (first argument)" |
This file contains hidden or 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 sh | |
isofile='./config/iso_filename.txt' | |
isofile_pretty="$(basename "${isofile}")" | |
iso="${1}" | |
# if the user supplied an argument, write it to the file, otherwise offer them a | |
# choice of all present ISO files | |
if [ -n "${iso}" ]; then | |
echo "${iso}" > "${isofile}" |
This file contains hidden or 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 | |
if [ "${EUID}" -ne 0 ]; then | |
echo "This script must be run as root!" 1>&2 | |
exit 1 | |
fi | |
# Gets the progress of a running SMART test as a string, or outputs nothing if | |
# no test is currently running. | |
function get_smart_progress { |
This file contains hidden or 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 | |
# Courtesy http://stackoverflow.com/a/246128. | |
SOURCE="${BASH_SOURCE[0]}" | |
while [ -h "$SOURCE" ]; do | |
# Resolve `$SOURCE` until the file is no longer a symlink. | |
DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)" | |
SOURCE="$(readlink "$SOURCE")" | |
# If `$SOURCE` was a relative symlink, we need to resolve it relative to the |
This file contains hidden or 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 sh | |
# handy colors, for readability | |
black='\033[0;30m' | |
red='\033[0;31m' | |
green='\033[0;32m' | |
yellow='\033[0;33m' | |
blue='\033[0;34m' | |
purple='\033[0;35m' | |
cyan='\033[0;36m' |