Dorothy Graveyard
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 | |
source "$DOROTHY/sources/strict.bash" | |
# Android Simulator | |
app=$(get-app "Android Studio.app") | |
if test -d "$app"; then | |
"$app/sdk/tools/emulator" -avd basic | |
else | |
echo "Android Studio is not installed" | |
fi |
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 | |
source "$DOROTHY/sources/strict.bash" | |
source "$DOROTHY/sources/arrays.bash" | |
requires_array_support 'mapfile' | |
# usage: | |
# mapfile -t values < <(array-evens "${tuples[@]}") | |
mapfile -t args < <(echo-lines -- "$@") # split jumbled arguments | |
for i in "${!args[@]}"; do | |
if is-even "$i"; then | |
echo "${args[$i]}" | |
fi | |
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
#!/usr/bin/env bash | |
source "$DOROTHY/sources/strict.bash" | |
source "$DOROTHY/sources/arrays.bash" | |
requires_array_support 'mapfile' | |
# usage: | |
# mapfile -t values < <(array-odds "${tuples[@]}") | |
mapfile -t args < <(echo-lines -- "$@") # split jumbled arguments | |
for i in "${!args[@]}"; do | |
if is-odd "$i"; then | |
echo "${args[$i]}" | |
fi | |
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
#!/usr/bin/env bash | |
source "$DOROTHY/sources/strict.bash" | |
needle="${1?:'USAGE: array-tuple-select key <[key, value], ...>'}" | |
found='no' | |
# cycle through the tuples | |
# remember @:0 is the command, @:1 is the needle, @:2:... is the tuples | |
for item in "${@:2}"; do | |
if test "$found" = 'yes'; then | |
echo "$item" | |
exit 0 | |
elif test "$item" = "$needle"; then | |
found='yes' | |
fi | |
done | |
# needle not found | |
exit 1 |
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
# function has_array_support { | |
# for arg in "$@"; do | |
# if [[ $ARRAYS != *" $arg"* ]]; then | |
# return 1 | |
# fi | |
# done | |
# } | |
# function requires_array_support { | |
# if ! has_array_support "$@"; then | |
# echo-style \ | |
# --error="Array support insufficient." $'\n' \ | |
# --bold="$0" " is incompatible with " --bold="bash $BASH_VERSION" $'\n' \ | |
# "Run " --bold="setup-util-bash" " to upgrade capabilities, then run the prior command again." >/dev/stderr | |
# return 95 # Operation not supported | |
# fi | |
# } | |
# function may_require_array_support { | |
# # this is useful for features like `empty` | |
# # as they may not be triggered under normal circumstances | |
# # when all options and arguments are provided | |
# # trunk-ignore(shellcheck/SC2064) | |
# trap "requires_array_support $* || :" ERR | |
# } |
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 | |
source "$DOROTHY/sources/strict.bash" | |
# you probably don't want to use this | |
# you probably want ask, or choose-option | |
# timeout | |
# pid="$BASHPID" | |
# timeout="${TIMEOUT:-3600}" # timeout one hour | |
# ( sleep "$timeout" && kill "$pid" ) & | |
# ^ this works for timeout, but prevents the select from returning | |
# choose | |
select key in "$@"; do | |
test -n "$key" && break | |
done >/dev/tty | |
# send result | |
echo "$key" |
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 | |
source "$DOROTHY/sources/strict.bash" | |
if test "$#" -eq 1; then | |
outputFile="concat.$1" | |
if test -f "$outputFile"; then | |
rm "$outputFile" | |
fi | |
count=0 | |
find-files --extension="$1" | while read -r inputFile; do | |
count=$((count + 1)) | |
echo -ne "\\r$count $inputFile" | |
cat "$inputFile" >>"$outputFile" | |
done | |
else | |
echo "concatfiles <extension>" | |
fi |
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 | |
source "$DOROTHY/sources/strict.bash" | |
source "$DOROTHY/sources/edit.sh" | |
edit /Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml | |
open "https://help.backblaze.com/hc/en-us/articles/220973007-Advanced-Topic-Setting-Custom-Exclusions-via-XML" |
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 | |
source "$DOROTHY/sources/strict.bash" | |
# wait a second for stdin lines, and forward each one along | |
stdin="no" | |
while read -rt 1 item; do | |
stdin="yes" | |
echo "$item" | |
done <&0 | |
# stdin was empty | |
if test "$stdin" = "no"; then | |
# output failure if we have it | |
if test "$#" -ne 0; then | |
stderr echo "$@" | |
fi | |
exit 1 | |
fi | |
# replaced by echo-or-fail |
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 | |
rm ~/.mozilla/firefox/*.default/.parentlock |
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 | |
while ! ("$@"); do | |
echo "trying again..." | |
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
function git_checkout_fresh { | |
# https://stackoverflow.com/a/13969482/130638 | |
git checkout --orphan "$1" | |
git rm --cached -r . || : | |
mkdir old | |
mv !(old) old/ | |
} |
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 | |
source "$DOROTHY/sources/strict.bash" | |
# iOS Simulator | |
app=$(get-app 'Xcode-beta.app') | |
if test -d "$app"; then | |
open "$app/Contents/Developer/Applications/Simulator.app" | |
else | |
app=$(get-app 'Xcode.app') | |
if test -d "$app"; then | |
open "$app/Contents/Developer/Applications/Simulator.app" | |
else | |
echo "Xcode is not installed" | |
fi | |
fi |
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 | |
while true; do | |
echo 'looping' | |
sleep 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
#!/usr/bin/env bash | |
source "$DOROTHY/sources/strict.bash" | |
redis:stop && redis:start && sleep 1 && redis:flush |
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 | |
source "$DOROTHY/sources/strict.bash" | |
echo 'flushdb' | redis-cli |
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 | |
source "$DOROTHY/sources/strict.bash" | |
redis-server & |
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 | |
source "$DOROTHY/sources/strict.bash" | |
redis-cli shutdown && echo 'killed existing redis-server' || echo 'no existing redis-server' |
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 | |
source "$DOROTHY/sources/strict.bash" | |
# dependencies | |
env QUIET=yes setup-util-jq | |
env QUIET=yes setup-util-gh | |
# act | |
action="${1:-open}" | |
PASS="\e[1;4;32m" | |
FAILURE="\e[1;4;31m" | |
NORMAL="\e[0m" | |
if test "$action" = "browse"; then | |
gh browse | |
elif test "$action" = "status"; then | |
echo -n 'ci: ' | |
repo ci | |
echo -n 'version: ' | |
repo version | |
echo 'move onto the next package' | |
elif test "$action" = "ci"; then | |
travis status # "hhub ci-status" is unreliable | |
elif test "$action" = "slug"; then | |
git remote get-url origin | sed 's/.*github.com.//; s/.git//' | |
elif test "$action" = "travis"; then | |
travisTLD="$(jq -r '.badges.config.travisTLD' <package.json)" | |
if is-empty-value "$travisTLD"; then | |
travisTLD="com" | |
fi | |
open "https://travis-ci.${travisTLD}/$(repo slug)" | |
elif test "$action" = "version"; then | |
name="$(jq -r .name package.json)" | |
version="$(jq -r .version package.json)" | |
published="$(npm view "$name@$version" version)" | |
if test "$version" = "$published"; then | |
echo -e "version $version ${PASS}released${NORMAL}" | |
else | |
stderr echo -e "version $version ${FAILURE}unreleased${NORMAL}" | |
exit 1 | |
fi | |
else | |
stderr echo "USAGE: repo <browse|status|travis|ssh|version>" | |
exit 1 | |
fi |
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 | |
source "$DOROTHY/sources/strict.bash" | |
# Make the directory | |
rm -Rf "$HOME/.clojure" | |
mkdir "$HOME/.clojure" | |
cd "$HOME/.clojure" || exit 1 | |
# Install Clojure | |
down-zip http://repo1.maven.org/maven2/org/clojure/clojure/1.8.0/clojure-1.8.0.zip | |
# Install ClojureScript | |
cd "$HOME/bin" || exit 1 | |
down https://github.com/clojure/clojurescript/releases/download/r1.9.229/cljs.jar | |
# Install Boot | |
cd "$HOME/bin" || exit 1 | |
down https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh | |
chmod +x boot.sh |
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 | |
source "$DOROTHY/sources/strict.bash" | |
if test -f "$HOME/.travis/config.yml"; then | |
grep access_token <"$HOME/.travis/config.yml" | sed -E 's/.+: //' | |
else | |
stderr echo "$HOME/.travis/config.yml was not found" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment