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
get_script_path () { | |
printf '%s' "$(realpath "${BASH_SOURCE[0]}")" | |
} |
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
# Return a random number between two limits | |
#------------------------------------------------------------------------------- | |
function random { | |
#default to numbers between 1-10 | |
local _min="${1:-1}" | |
local _max="${2:-10}" | |
local diff=$((${_max}-${_min}+1)) | |
echo -n "$(($((${RANDOM}%${diff}))+${_min}))" | |
} |
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 | |
function bashful { | |
( | |
local bashful_path="$(find /tmp/ -name "jmcantrell-bashful-*" -print -quit 2>/dev/null)" | |
if [[ -z ${bashful_path:+x} ]]; then | |
curl -fsSL https://github.com/jmcantrell/bashful/tarball/master | tar xz -C /tmp/ | |
bashful_path="$(find /tmp/ -name "jmcantrell-bashful-*" -print -quit 2>/dev/null)" | |
fi | |
if [[ -z ${bashful_path:+x} ]]; then |
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 | |
function here_printf { | |
local format=${1:-"%b\n"} | |
local text | |
read -r -d '' text | |
printf "${format}" "${text}" | |
} |
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
extension NSColor { | |
convenience init?(hexString: String) { | |
var hexString: String = hexString.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) | |
if hexString.hasPrefix("#") { | |
let startIndex = hexString.index(hexString.startIndex, offsetBy: 1) | |
hexString = String(hexString[startIndex...]) | |
} | |
if hexString.count == 3 || hexString.count == 4 { | |
hexString = hexString.reduce(into: "") { (paddedHex, hexCharacter) in |
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 | |
function bashful { | |
( | |
local bashful_path="$(find /tmp/ -name "jmcantrell-bashful-*" -print -quit 2>/dev/null)" | |
if [[ -z ${bashful_path:+x} ]]; then | |
curl -fsSL https://github.com/jmcantrell/bashful/tarball/master | tar xz -C /tmp/ | |
bashful_path="$(find /tmp/ -name "jmcantrell-bashful-*" -print -quit 2>/dev/null)" | |
fi | |
if [[ -z ${bashful_path:+x} ]]; then |
OlderNewer