♡ฅ(ᐤˊ ฅˋᐤ♪)

main
pxi 2023-12-14 00:11:02 +01:00
parent b159ec33c1
commit 1964a0feae
14 changed files with 2324 additions and 0 deletions

100
toys/alice-in-unixland.sh Executable file
View File

@ -0,0 +1,100 @@
#!/bin/bash
# Feb 2013 - Command line practice exercise
# Story telling time...
# Narrator function
narrate () {
# echo narration
echo $1
echo ""
# Suspense...
sleep 1
};
narrate "ALICE IN UNIXLAND"
narrate "Creating ~/alice_in_wonderland"
mkdir -vp ~/alice_in_wonderland
cd ~/alice_in_wonderland
# Get the book strip tags, etc...
narrate "Getting Alice in Wonderland text"
wget -O - "$@" https://media.patxipierce.com/r/alice-in-wonderland | sed 's/<[^>]\+>//g' >> alice_in_wonderland.txt
narrate "Alice was board, looking at her sister book with no pictures in it."
echo "bored" >> alice.txt
narrate "When she saw a white rabbit talking about the time"
echo "$(date)" >> white_rabbit.txt
echo "Im late! Im late!" >> white_rabbit.txt
narrate "Just in time to see it pop down a large rabbit-hole under the hedge."
cat white_rabbit.txt > /dev/null
narrate "In another moment down went Alice after it,"
narrate "never once considering how in the world she was to get out again."
cat alice.txt > /dev/null
narrate "She saw on her way down cupboards and book shelves;"
cupboard=("orange_marmalade" "maps" "pictures")
bookshelf=("books")
narrate "She took down a jar from one of the shelves as she passed;"
narrate "But to her great disappointment it was empty."
echo "${cupboard[0]}=''" >> alice.txt
cupboard[0]=""
narrate "she did not like to drop the jar for fear of killing somebody,"
narrate "so managed to put it into one of the cupboards as she fell past it."
mv alice.txt tmp.txt && cat tmp.txt | sed '$d' > alice.txt
cupboard[0]=$(sed '$!d' tmp.txt) && rm -f tmp.txt
narrate "Then she fell some more..."
narrate "Until she fell in to a hump of stick and dry leaves,"
narrate "and the fall was over."
mkdir -p dry_leaves && mv alice.txt dry_leaves/
narrate "She saw the white rabbit in sight"
echo "${date}" >> white_rabbit.txt
narrate "Away went Alice like the wind and was just in time to hear it say, as it turned a corner,"
echo "Oh my ears and whiskers, how late it's getting!" >> white_rabbit.txt
narrate "Turned corner but the Rabbit was no longer to be seen:"
mv white_rabbit.txt .white_rabbit.txt
narrate "She found herself in a long, low hall,"
mkdir -p low_hall
mv dry_leaves/alice.txt low_hall/alice.txt
narrate "There were doors all round the hall"
mkdir -p low_hall/door1 low_hall/door2 low_hall/door3 low_hall/door4
narrate "but they were all locked;"
chmod 000 low_hall/door*
narrate "Suddenly she came upon a little three-legged table with a tiny golden key"
three_legged_table=("golden key")
echo ${three_legged_table[0]} >> alice.txt
# maybe someday I'll finish the chapter...

632
toys/ask.sh Executable file
View File

@ -0,0 +1,632 @@
#! /bin/bash
function ask() {
COLUMNS=$(tput cols);
LINES=$(tput lines);
bgcolor=$(tput setab 0)
bold=$(tput bold);
unbold=$(tput sgr0);
if [ "$COLUMNS" -gt 210 ] && [ "$LINES" -gt 30 ] ; then
WAIT=$(cat <<'END_HEREDOC'
/\\\ /\\\ /\\\\\\\\\ /\\\\\\\\\\\ /\\\\\\\\\\\\\\\
\/\\\ \/\\\ /\\\\\\\\\\\\\ \/////\\\/// \///////\\\/////
\/\\\ \/\\\ /\\\/////////\\\ \/\\\ \/\\\
\//\\\ /\\\ /\\\ \/\\\ \/\\\ \/\\\ \/\\\
\//\\\ /\\\\\ /\\\ \/\\\\\\\\\\\\\\\ \/\\\ \/\\\
\//\\\/\\\/\\\/\\\ \/\\\/////////\\\ \/\\\ \/\\\
\//\\\\\\//\\\\\ \/\\\ \/\\\ \/\\\ \/\\\
\//\\\ \//\\\ \/\\\ \/\\\ /\\\\\\\\\\\ \/\\\
\/// \/// \/// \/// \/////////// \///
END_HEREDOC
);
NUMBER_3=$(cat <<'END_HEREDOC'
/\\\\\\\\\\\\\\\ /\\\ /\\\ /\\\\\\\\\ /\\\\\\\\\\\\\\\ /\\\\\\\\\\\\\\\
\///////\\\///// \/\\\ \/\\\ /\\\///////\\\ \/\\\/////////// \/\\\///////////
\/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\
\/\\\ \/\\\\\\\\\\\\\\\ \/\\\\\\\\\\\/ \/\\\\\\\\\\\ \/\\\\\\\\\\\
\/\\\ \/\\\/////////\\\ \/\\\//////\\\ \/\\\/////// \/\\\///////
\/\\\ \/\\\ \/\\\ \/\\\ \//\\\ \/\\\ \/\\\
\/\\\ \/\\\ \/\\\ \/\\\ \//\\\ \/\\\ \/\\\
\/\\\ \/\\\ \/\\\ \/\\\ \//\\\ \/\\\\\\\\\\\\\\\ \/\\\\\\\\\\\\\\\
\/// \/// \/// \/// \/// \/////////////// \///////////////
END_HEREDOC
);
NUMBER_2=$(cat <<'END_HEREDOC'
/\\\\\\\\\\\\\\\ /\\\ /\\\ /\\\\\
\///////\\\///// \/\\\ \/\\\ /\\\///\\\
\/\\\ \/\\\ \/\\\ /\\\/ \///\\\
\/\\\ \//\\\ /\\\ /\\\ /\\\ \//\\\
\/\\\ \//\\\ /\\\\\ /\\\ \/\\\ \/\\\
\/\\\ \//\\\/\\\/\\\/\\\ \//\\\ /\\\
\/\\\ \//\\\\\\//\\\\\ \///\\\ /\\\
\/\\\ \//\\\ \//\\\ \///\\\\\/
\/// \/// \/// \/////
END_HEREDOC
);
NUMBER_1=$(cat <<'END_HEREDOC'
/\\\\\ /\\\\\ /\\\ /\\\\\\\\\\\\\\\
/\\\///\\\ \/\\\\\\ \/\\\ \/\\\///////////
/\\\/ \///\\\ \/\\\/\\\ \/\\\ \/\\\
/\\\ \//\\\ \/\\\//\\\ \/\\\ \/\\\\\\\\\\\
\/\\\ \/\\\ \/\\\\//\\\\/\\\ \/\\\///////
\//\\\ /\\\ \/\\\ \//\\\/\\\ \/\\\
\///\\\ /\\\ \/\\\ \//\\\\\\ \/\\\
\///\\\\\/ \/\\\ \//\\\\\ \/\\\\\\\\\\\\\\\
\///// \/// \///// \///////////////
END_HEREDOC
);
ASK=$(cat <<'END_HEREDOC'
/\\\\\\\\\ /\\\\\\\\\\\ /\\\ /\\\
/\\\\\\\\\\\\\ /\\\/////////\\\ \/\\\ /\\\//
/\\\/////////\\\ \//\\\ \/// \/\\\ /\\\//
\/\\\ \/\\\ \////\\\ \/\\\\\\//\\\
\/\\\\\\\\\\\\\\\ \////\\\ \/\\\// \//\\\
\/\\\/////////\\\ \////\\\ \/\\\ \//\\\
\/\\\ \/\\\ /\\\ \//\\\ \/\\\ \//\\\
\/\\\ \/\\\ \///\\\\\\\\\\\/ \/\\\ \//\\\
\/// \/// \/////////// \/// \///
/\\\ /\\\ /\\\\\ /\\\ /\\\ /\\\\\\\\\
\///\\\ /\\\/ /\\\///\\\ \/\\\ \/\\\ /\\\///////\\\
\///\\\/\\\/ /\\\/ \///\\\ \/\\\ \/\\\ \/\\\ \/\\\
\///\\\/ /\\\ \//\\\ \/\\\ \/\\\ \/\\\\\\\\\\\/
\/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\//////\\\
\/\\\ \//\\\ /\\\ \/\\\ \/\\\ \/\\\ \//\\\
\/\\\ \///\\\ /\\\ \//\\\ /\\\ \/\\\ \//\\\
\/\\\ \///\\\\\/ \///\\\\\\\\\/ \/\\\ \//\\\
\/// \///// \///////// \/// \///
/\\\ /\\\ /\\\ /\\\\\\\\\\\\\\\ /\\\\\\\\\\\ /\\\\\\\\\\\\\\\ /\\\\\\\\\\\ /\\\\\ /\\\\\ /\\\
/\\\\/\\\\ \/\\\ \/\\\ \/\\\/////////// /\\\/////////\\\ \///////\\\///// \/////\\\/// /\\\///\\\ \/\\\\\\ \/\\\
/\\\//\////\\\ \/\\\ \/\\\ \/\\\ \//\\\ \/// \/\\\ \/\\\ /\\\/ \///\\\ \/\\\/\\\ \/\\\
/\\\ \//\\\ \/\\\ \/\\\ \/\\\\\\\\\\\ \////\\\ \/\\\ \/\\\ /\\\ \//\\\ \/\\\//\\\ \/\\\
\//\\\ /\\\ \/\\\ \/\\\ \/\\\/////// \////\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\\//\\\\/\\\
\///\\\\/\\\\/ \/\\\ \/\\\ \/\\\ \////\\\ \/\\\ \/\\\ \//\\\ /\\\ \/\\\ \//\\\/\\\
\////\\\// \//\\\ /\\\ \/\\\ /\\\ \//\\\ \/\\\ \/\\\ \///\\\ /\\\ \/\\\ \//\\\\\\
\///\\\\\\ \///\\\\\\\\\/ \/\\\\\\\\\\\\\\\ \///\\\\\\\\\\\/ \/\\\ /\\\\\\\\\\\ \///\\\\\/ \/\\\ \//\\\\\
\////// \///////// \/////////////// \/////////// \/// \/////////// \///// \/// \/////
END_HEREDOC
);
elif [ "$COLUMNS" -gt 164 ] && [ "$LINES" -gt 42 ] ; then
WAIT=$(cat <<'END_HEREDOC'
___________ ___________ __________ _______________ ________ ________ _________
/::::::::::/| |\::::::::::\ /:::::::::::::\ |::::::::::::::::\ /::::::::\_____/::::::::\ |:::::::::|
/::::::::::/:| |:\::::::::::\ /::::::_____::::\ \___/\:::::\\___/| |\:::::::::::::::::::::::/| |:::::::::|
|::::::::::/::| _______ |::\::::::::::| |::::::/ \::::\ \|____\:::::\___|/ |:\:::::::::::::::::::::/:| |:::::::::|
|::::::::::|::| |:::::::| |::|::::::::::| |:::::| |:::::\ |:::::| |::|::::::::::::::::::::|:| |:::::::/
|::::::::::|::| |:::::::| |::|::::::::::| |:::::| |:::::| |:::::| |::\::::::::::::::::::::|:| |::::|
|::::::::::|::| |:::::::| |::|::::::::::| |:::::| |:::::| |:::::| |:: \_____/\::::::\____/::/ |::::|
|::::::::::|::| |:::::::| |::|::::::::::| |:::::| |:::::\ |:::::| \__|_____|:\::::::\___|/ |::::|
|::::::::::|::| |:::::::| |::|::::::::::| |:::::| |::::::\ |:::::| \::\::::::\ |::::|
|:::::::::::\:| |:::::::| |:/:::::::::::| |::::::\_____/::::::::\ __ /::::::/ __ \::\::::::\ \\__//
|::::::::::|\\ /:::::::\ //|::::::::::| |\:::::::::::/\::::::::\ /::\/::::::/_/::| \::\::::::\ ________
|\__________\ \________/ /___________/| |\___________\:\________\ |_______________/:| \::\______\ |_________\
|:|:::::::::| |:::::::| |:::::::::|:| |:::|:::::::::|:|::::::::| |::::::::::::::|:/ \:|:::::::| |:::::::::|
|:|:::::::::| |:::::::| |:::::::::|:| |::|:::::::::|:|::::::::| |::::::::::::::|:/ \:|:::::::| |:::::::::|
\|_________|\ |_______| /|_________|/ \_|_________|\|________| |______________|/ \|_______| |_________|
END_HEREDOC
);
NUMBER_3=$(cat <<'END_HEREDOC'
_____ _____
________ ________ __ __ ___________ _____\::::\: _____\::::\
/::::::::\ /::::::::\ /::\ /::\ \::::::::::\ /::::/ |::::| /::::/ |::::|
|\:::::::::\/:::::::::/| /:::/| |\:::\ \::::/\::::\ /::::/ /___/| /::::/ /___/|
|:\::::::::::::/\____/:| /:::// \\:::\ |:::\_\::::| |::::|__ |___|/ |::::|__ |___|/
|::\______/\:::\:::::|:| /::::\_____/::::\ |::::::___/ |:::::::\ |:::::::\
\:|::::::|:\:::\____|/ /::::/\_____/\::::\ |::::::\ ____ |:::::__/ __ |:::::__/:__
\|______|::\:::\ /:::://\_____/\\::::\ /:::::/\:\/::::\ |\::::\::/::\ |\::::\::/::\
___ ___ \::\___\ /____/:| |:\____\ /_____/:|\______| |:\____\/::::| |:\____\/::::| ___ ___
|:::| |:::| \:|:::| |::::|:| |:|::::| |:::::|:|:|:::::| |:|::::|____/| |:|::::|____/| |:::| |:::|
|___| |___| \|___| |____|/ \|____| |_____|/ \|_____| \|____|:::|:| \|____|:::|:| |___| |___|
|___|/ |___|/
END_HEREDOC
);
NUMBER_2=$(cat <<'END_HEREDOC'
________ ________ _______ _______ ____
/::::::::\::/::::::::\ /::::::/| |\::::::\ ____\_::\__
|\:::::::::\/:::::::::/| /::::::/:| |:\::::::\ /:::::/:::::\
|:\::::::::::::/\____/:| |::::::/::|___|::\::::::| /:::::/\::::::|
|::\______/\:::\:::::|:| |::::::|::|:::|::|::::::| |:::::|::|:::::|
\:|::::::|:\:::\____|/ |:::::::\:\:::/:/:::::::| |:::::|::|:::::|
\|______|::\:::\ |::::::|\\/:::\//|::::::| |:::::|:/:::::/|
___ ___ \::\___\ |\_____\|\_____/|/_____/| |\:::::\_____/:| ___ ___
|:::| |:::| \:|:::| |:|:::::|:|:::|:|:::::|:| |:\_____\:::|:/ |:::| |:::|
|___| |___| \|___| \|_____|\|___|/|_____|/ \:|::::|___|/ |___| |___|
\|____|
END_HEREDOC
);
NUMBER_1=$(cat <<'END_HEREDOC'
_____
____ _____ _____ _____\::::\
____\_::\__ |\::::\:::\::::\ /::::/:|::::|
/:::::/:::::\: \\::::\:::|::::| /::::/::/___/|
/:::::/\::::::| \\::::\::|::::| |::::|__:|___|/
|:::::|::|:::::| \|::::\:|::::| |:::::::\:::::
|:::::|::|:::::| |:::::\|::::| |:::::__/:__::
|:::::|:/:::::/| /:::::/\::::::\ |\::::\::/::\:
___ ___ |\:::::\_____/:| /_____/:/______/| |:\____\/::::| ___ ___
|:::| |:::| |:\_____\:::|:/ |::::::|:|:::::|:| |:|::::|____/| |:::| |:::|
|___| |___| \:|::::|___|/ |______|/|_____|/ \|____|:::|:| |___| |___|
\|____| |___|/
END_HEREDOC
);
ASK=$(cat <<'END_HEREDOC'
_____ _____ ______ _______ ______ _____ ____ ______ _____ ___________
/::::::|_ _____\::::\ |\:::::\ \::::::\ |\:::::\ |:::::| ____\_::\__ \:::::\ \::::\ \:::::::::::\
/:::::::::\ /::::/ \::::| \\:::::\ |:::::/| \ \:::::\|:::::| /::::::/:::::\ \::::| |::::| \::::/\::::\
|:::::/\::::\ |::::| /___/| \|:::::|/:::::// \ \:::::::::::| /::::::/\::::::| |:::| |::::| |:::\_\::::|
|::::| |::::\ ____\::::\ |:::|| |:::::|:::: // \ \____::::: | |:::::| |:::::| |::::\_/:::/| |::::: ___/
|:::::\/::::::\ /::::/\::::\|___|/ |:::::|\:::::\ \|___/:::::/| |:::::| |:::::| |\:::::::::\| |::::::\ ____
|\::::::/\:::::\ |::::|/ \::::\ /:::::/|\|:::::| /:::::/:| |:::::| /:::::/| |:\::::::::::\__ /::::/\ \/::::\
|:\_____\ \_____\ |\____\ /____/| /_____/:|/_____/| /_____/::/ |\::::\_____/:| \:\_____/\:::::\ /_____/:|\______|
|:|:::::| |:::::| | |:::||::::| | |:::::|:/ |::::|:| |:::::|:/ | \_____\:::|:/ \:|::::|/___/| |:::::|:|:|:::::|
\|_____|\|_____| \|___||____|/ |_____|/ |____|/ |_____|/ \ |::::|___|/ \|____|:::| | |_____|/ \|_____|
\|____| |___|/
______ _____
___\__:::\_ ______ _____ _____\::::\ _____ ________ ________ ____________ ____ _____ _____
/:::::/:::::\ \:::::\ \::::\ /::::/ |::::| _____\::::\ /::::::::\ /::::::::\ /::::::::::::\ ____\_::\__ |\::::\ \::::\
/:::::/\:::::| \::::| |::::| /::::/ /___/| /::::/ \::::| |\:::::::::\/:::::::::/| |\___/\::\\___/| /:::::/:::::\ \\::::\ |::::|
|:::::| |::::| |:::| |::::| ::::|__ |___|/ |::::| /___/| | \::::::::::::/\____/:| \|____\::\___|/ /:::::/\::::::| \\::::\ |::::|
|:::::| /:::::| |::::\_/:::/| :::::::\ ____\::::\ |:::|| | \______/\:::\:::::|:| |::| |:::::| |:::::| \|::::\ |::::|
|:::::|/:::::/| |\:::::::::\| :::::__/ __ /::::/\::::\|___|/ \ |::::::|:\:::\____|/ __ /:::/ __ |:::::| |:::::| |:::::\|::::|
|\:::::\_:::/_|_ | \:::::::::\__ \::::\ /::\ |::::|/ \::::\ \|______|::\:::\ /::\/:::/_/::| |:::::| /:::::/| /:::::/\::::::\
|:\_____\\______\ \ \_____/\::::\ :\____\/::::| |\____\ /____/| \::\___\ |____________/| |\:::::\_____/:| /_____/ /______/|
|:|:::::|:::::::| \ |::::|/___/| :|::::|____/| |:|:::||::::|:| \:|:::| |:::::::::::|:/ |:\_____\:::|:/ |::::::| |:::::|:|
\|_____|_______| \|____|:::| | \|____|:::|:| \|___||____|/ \|___| |___________|/ \:|::::|___|/ |______|/|_____|/
|___|/ |___|/ \|____|
END_HEREDOC
);
elif [ "$COLUMNS" -gt 144 ] && [ "$LINES" -gt 47 ] ; then
WAIT=$(cat <<'END_HEREDOC'
WWWWWWWW WWWWWWWW AAA IIIIIIIIII TTTTTTTTTTTTTTTTTTTTTTT
W::::::W W::::::W A:::A I::::::::I T:::::::::::::::::::::T
W::::::W W::::::W A:::::A I::::::::I T:::::::::::::::::::::T
W::::::W W::::::W A:::::::A II::::::II T:::::TT:::::::TT:::::T
W:::::W WWWWW W:::::W A:::::::::A I::::I TTTTTT T:::::T TTTTTT
W:::::W W:::::W W:::::W A:::::A:::::A I::::I T:::::T
W:::::W W:::::::W W:::::W A:::::A A:::::A I::::I T:::::T
W:::::W W:::::::::W W:::::W A:::::A A:::::A I::::I T:::::T
W:::::W W:::::W:::::W W:::::W A:::::A A:::::A I::::I T:::::T
W:::::W W:::::W W:::::W W:::::W A:::::AAAAAAAAA:::::A I::::I T:::::T
W:::::W:::::W W:::::W:::::W A:::::::::::::::::::::A I::::I T:::::T
W:::::::::W W:::::::::W A:::::AAAAAAAAAAAAA:::::A I::::I T:::::T
W:::::::W W:::::::W A:::::A A:::::A II::::::II TT:::::::TT
W:::::W W:::::W A:::::A A:::::A I::::::::I T:::::::::T
W:::W W:::W A:::::A A:::::A I::::::::I T:::::::::T
WWW WWW AAAAAAA AAAAAAA IIIIIIIIII TTTTTTTTTTT
END_HEREDOC
);
NUMBER_3=$(cat <<'END_HEREDOC'
333333333333333
3:::::::::::::::33
3::::::33333::::::3
3333333 3:::::3
3:::::3
3:::::3
33333333:::::3
3:::::::::::3
33333333:::::3
3:::::3
3:::::3
3:::::3
3333333 3:::::3
...... ...... ...... 3::::::33333::::::3 ...... ...... ......
.::::. .::::. .::::. 3:::::::::::::::33 .::::. .::::. .::::.
...... ...... ...... 333333333333333 ...... ...... ......
END_HEREDOC
);
NUMBER_2=$(cat <<'END_HEREDOC'
222222222222222
2:::::::::::::::22
2::::::222222:::::2
2222222 2:::::2
2:::::2
2:::::2
2222::::2
22222::::::22
22::::::::222
2:::::22222
2:::::2
2:::::2
2:::::2 222222
...... ...... ...... 2::::::2222222:::::2 ...... ...... ......
.::::. .::::. .::::. 2::::::::::::::::::2 .::::. .::::. .::::.
...... ...... ...... 22222222222222222222 ...... ...... ......
END_HEREDOC
);
NUMBER_1=$(cat <<'END_HEREDOC'
1111111
1::::::1
1:::::::1
111:::::1
1::::1
1::::1
1::::1
1::::l
1::::l
1::::l
1::::l
1::::l
111::::::111
...... ...... ...... 1::::::::::1 ...... ...... ......
.::::. .::::. .::::. 1::::::::::1 .::::. .::::. .::::.
...... ...... ...... 111111111111 ...... ...... ......
END_HEREDOC
);
ASK=$(cat <<'END_HEREDOC'
kkkkkkkk
k::::::k
k::::::k
k::::::k
aaaaaaaaaaaaa ssssssssss k:::::k kkkkkkk yyyyyyy yyyyyyy ooooooooooo uuuuuu uuuuuu rrrrr rrrrrrrrr
a::::::::::::a ss::::::::::s k:::::k k:::::k y:::::y y:::::yoo:::::::::::oo u::::u u::::u r::::rrr:::::::::r
aaaaaaaaa:::::ass:::::::::::::s k:::::k k:::::k y:::::y y:::::yo:::::::::::::::ou::::u u::::u r:::::::::::::::::r
a::::as::::::ssss:::::s k:::::k k:::::k y:::::y y:::::y o:::::ooooo:::::ou::::u u::::u rr::::::rrrrr::::::r
aaaaaaa:::::a s:::::s ssssss k::::::k:::::k y:::::y y:::::y o::::o o::::ou::::u u::::u r:::::r r:::::r
aa::::::::::::a s::::::s k:::::::::::k y:::::y y:::::y o::::o o::::ou::::u u::::u r:::::r rrrrrrr
a::::aaaa::::::a s::::::s k:::::::::::k y:::::y:::::y o::::o o::::ou::::u u::::u r:::::r
a::::a a:::::assssss s:::::s k::::::k:::::k y:::::::::y o::::o o::::ou:::::uuuu:::::u r:::::r
a::::a a:::::as:::::ssss::::::sk::::::k k:::::k y:::::::y o:::::ooooo:::::ou:::::::::::::::uur:::::r
a:::::aaaa::::::as::::::::::::::s k::::::k k:::::k y:::::y o:::::::::::::::o u:::::::::::::::ur:::::r
a::::::::::aa:::as:::::::::::ss k::::::k k:::::k y:::::y oo:::::::::::oo uu::::::::uu:::ur:::::r
aaaaaaaaaa aaaa sssssssssss kkkkkkkk kkkkkkk y:::::y ooooooooooo uuuuuuuu uuuurrrrrrr
y:::::y
y:::::y
y:::::y
y:::::y
yyyyyyy
tttt iiii
ttt:::t i::::i
t:::::t iiii
t:::::t
qqqqqqqqq qqqqquuuuuu uuuuuu eeeeeeeeeeee ssssssssss ttttttt:::::ttttttt iiiiiii ooooooooooo nnnn nnnnnnnn
q:::::::::qqq::::qu::::u u::::u ee::::::::::::ee ss::::::::::s t:::::::::::::::::t i:::::i oo:::::::::::oo n:::nn::::::::nn
q:::::::::::::::::qu::::u u::::u e::::::eeeee:::::eess:::::::::::::s t:::::::::::::::::t i::::i o:::::::::::::::on::::::::::::::nn
q::::::qqqqq::::::qqu::::u u::::u e::::::e e:::::es::::::ssss:::::stttttt:::::::tttttt i::::i o:::::ooooo:::::onn:::::::::::::::n
q:::::q q:::::q u::::u u::::u e:::::::eeeee::::::e s:::::s ssssss t:::::t i::::i o::::o o::::o n:::::nnnn:::::n
q:::::q q:::::q u::::u u::::u e:::::::::::::::::e s::::::s t:::::t i::::i o::::o o::::o n::::n n::::n
q:::::q q:::::q u::::u u::::u e::::::eeeeeeeeeee s::::::s t:::::t i::::i o::::o o::::o n::::n n::::n
q::::::q q:::::q u:::::uuuu:::::u e:::::::e ssssss s:::::s t:::::t tttttt i::::i o::::o o::::o n::::n n::::n
q:::::::qqqqq:::::q u:::::::::::::::uue::::::::e s:::::ssss::::::s t::::::tttt:::::ti::::::io:::::ooooo:::::o n::::n n::::n
q::::::::::::::::q u:::::::::::::::u e::::::::eeeeeeee s::::::::::::::s tt::::::::::::::ti::::::io:::::::::::::::o n::::n n::::n
qq::::::::::::::q uu::::::::uu:::u ee:::::::::::::e s:::::::::::ss tt:::::::::::tti::::::i oo:::::::::::oo n::::n n::::n
qqqqqqqq::::::q uuuuuuuu uuuu eeeeeeeeeeeeee sssssssssss ttttttttttt iiiiiiii ooooooooooo nnnnnn nnnnnn
q:::::q
q:::::q
q:::::::q
q:::::::q
q:::::::q
qqqqqqqqq
END_HEREDOC
);
elif [ "$COLUMNS" -gt 80 ] && [ "$LINES" -gt 22 ] ; then
WAIT=$(cat <<'END_HEREDOC'
888 888 d8888 8888888 88888888888
888 o 888 d88888 888 888
888 d8b 888 d88P888 888 888
888 d888b 888 d88P 888 888 888
888d88888b888 d88P 888 888 888
88888P Y88888 d88P 888 888 888
8888P Y8888 d8888888888 888 888 d8b d8b d8b
888P Y888 d88P 888 8888888 888 Y8P Y8P Y8P
END_HEREDOC
);
NUMBER_1=$(cat <<'END_HEREDOC'
d888
d8888
888
888
888
888
d8b d8b d8b 888 d8b d8b d8b
Y8P Y8P Y8P 8888888 Y8P Y8P Y8P
END_HEREDOC
);
NUMBER_2=$(cat <<'END_HEREDOC'
.d8888b.
d88P Y88b
888
.d88P
.od888P"
d88P"
d8b d8b d8b 888" d8b d8b d8b
Y8P Y8P Y8P 888888888 Y8P Y8P Y8P
END_HEREDOC
);
NUMBER_3=$(cat <<'END_HEREDOC'
.d8888b.
d88P Y88b
.d88P
8888"
"Y8b.
888 888
d8b d8b d8b Y88b d88P d8b d8b d8b
Y8P Y8P Y8P "Y8888P" Y8P Y8P Y8P
END_HEREDOC
);
ASK=$(cat <<'END_HEREDOC'
d8888 888
d88888 888
d88P888 888
d88P 888.d8888b 888 888 888 888 .d88b. 888 888888d888
d88P 88888K 888 .88P 888 888d88""88b888 888888P"
d88P 888"Y8888b.888888K 888 888888 888888 888888
d8888888888 X88888 "88b Y88b 888Y88..88PY88b 888888
d88P 888 88888P'888 888 "Y88888 "Y88P" "Y88888888
888
Y8b d88P
"Y88P"
888 d8b
888 Y8P
888
.d88888888 888 .d88b. .d8888b 888888888 .d88b. 88888b.
d88" 888888 888d8P Y8b88K 888 888d88""88b888 "88b
888 888888 88888888888"Y8888b.888 888888 888888 888
Y88b 888Y88b 888Y8b. X88Y88b. 888Y88..88P888 888d8b
"Y88888 "Y88888 "Y8888 88888P' "Y888888 "Y88P" 888 888Y8P
888
888
888
END_HEREDOC
);
elif [ "$COLUMNS" -gt 70 ] && [ "$LINES" -gt 20 ] ; then
WAIT=$(cat <<'END_HEREDOC'
__ __ ______ ______ ______ __
/\ \ __/\ \/\ _ \/\__ _\/\__ _\ /\ \
\ \ \/\ \ \ \ \ \L\ \/_/\ \/\/_/\ \/ \ \ \
\ \ \ \ \ \ \ \ __ \ \ \ \ \ \ \ \ \ \
\ \ \_/ \_\ \ \ \/\ \ \_\ \__ \ \ \ \ \_\
\ `\___x___/\ \_\ \_\/\_____\ \ \_\ \/\_\
'\/__//__/ \/_/\/_/\/_____/ \/_/ \/_/
END_HEREDOC
);
NUMBER_1=$(cat <<'END_HEREDOC'
_
/' \
/\_, \
\/_/\ \
__ __ __ \ \ \ __ __ __
/\_\/\_\/\_\ \ \_\ /\_\/\_\/\_\
\/_/\/_/\/_/ \/_/ \/_/\/_/\/_/
END_HEREDOC
);
NUMBER_2=$(cat <<'END_HEREDOC'
___
/'___`\
/\_\ /\ \
\/_/// /__
__ __ __ // /_\ \ __ __ __
/\_\/\_\/\_\ /\______/ /\_\/\_\/\_\
\/_/\/_/\/_/ \/_____/ \/_/\/_/\/_/
END_HEREDOC
);
NUMBER_3=$(cat <<'END_HEREDOC'
__
/'__`\
/\_\L\ \
\/_/_\_<_
__ __ __ /\ \L\ \ __ __ __
/\_\/\_\/\_\ \ \____/ /\_\/\_\/\_\
\/_/\/_/\/_/ \/___/ \/_/\/_/\/_/
END_HEREDOC
);
ASK=$(cat <<'END_HEREDOC'
______ __
/\ _ \ /\ \
\ \ \L\ \ ____\ \ \/'\ __ __ ___ __ __ _ __
\ \ __ \ /',__\\ \ , < /\ \/\ \ / __`\/\ \/\ \/\`'__\
\ \ \/\ \/\__, `\\ \ \\`\ \ \ \_\ \/\ \L\ \ \ \_\ \ \ \/
\ \_\ \_\/\____/ \ \_\ \_\ \/`____ \ \____/\ \____/\ \_\
\/_/\/_/\/___/ \/_/\/_/ `/___/> \/___/ \/___/ \/_/
/\___/
\/__/
__
/\ \__ __
__ __ __ __ ____\ \ ,_\/\_\ ___ ___
/'__`\/\ \/\ \ /'__`\ /',__\\ \ \/\/\ \ / __`\ /' _ `\
/\ \L\ \ \ \_\ \/\ __//\__, `\\ \ \_\ \ \/\ \L\ \/\ \/\ \ __
\ \___, \ \____/\ \____\/\____/ \ \__\\ \_\ \____/\ \_\ \_\/\_\
\/___/\ \/___/ \/____/\/___/ \/__/ \/_/\/___/ \/_/\/_/\/_/
\ \_\
\/_/
END_HEREDOC
);
elif [ "$COLUMNS" -gt 50 ] && [ "$LINES" -gt 20 ] ; then
WAIT=$(cat <<'END_HEREDOC'
_______ __________________
|\ /|( ___ )\__ __/\__ __/
| ) ( || ( ) | ) ( ) (
| | _ | || (___) | | | | |
| |( )| || ___ | | | | |
| || || || ( ) | | | | |
| () () || ) ( |___) (___ | |
(_______)|/ \|\_______/ )_( () () ()
END_HEREDOC
);
NUMBER_1=$(cat <<'END_HEREDOC'
__
/ |
`| |
| |
_ _ _ _| |_ _ _ _
(_) (_) (_) \___/ (_) (_) (_)
END_HEREDOC
);
NUMBER_2=$(cat <<'END_HEREDOC'
_____
/ __ \
`' / /'
/ /
_ _ _ ./ /___ _ _ _
(_) (_) (_) \_____/ (_) (_) (_)
END_HEREDOC
);
NUMBER_3=$(cat <<'END_HEREDOC'
_____
|____ |
/ /
\ \
_ _ _ .___/ / _ _ _
(_) (_) (_) \____/ (_) (_) (_)
END_HEREDOC
);
ASK=$(cat <<'END_HEREDOC'
_
| |
__ _ ___| | __
/ _ / __| |/ /
| (_| \__ \ <
\__,_|___/_|\_\
_ _ ___ _ _ _ __
| | | |/ _ \| | | | __|
| |_| | (_) | |_| | |
\__, |\___/ \__,_|_|
__/ |
|___/
_ _
| | (_)
__ _ _ _ ___ ___| |_ _ ___ _ __
/ _ | | | |/ _ \/ __| __| |/ _ \| _ \
| (_| | |_| | __/\__ \ |_| | (_) | | | |_
\__, |\__,_|\___||___/\__|_|\___/|_| |_(_)
| |
|_|
END_HEREDOC
);
else
WAIT=$(cat <<'END_HEREDOC'
_ _ _ _ _ ___
| | | | / \ | ||_ _|
| V V || o || | | |
\_n_/ |_n_||_| |_| () () ()
END_HEREDOC
);
NUMBER_1=$(cat <<'END_HEREDOC'
___
|_ |
_ _ _ _| |_ _ _ _
|_|_|_| |_____| |_|_|_|
END_HEREDOC
);
NUMBER_2=$(cat <<'END_HEREDOC'
___
|_ |
_ _ _ | _| _ _ _
|_|_|_| |___| |_|_|_|
END_HEREDOC
);
NUMBER_3=$(cat <<'END_HEREDOC'
___
|_ |
_ _ _ |_ | _ _ _
|_|_|_| |___| |_|_|_|
END_HEREDOC
);
ASK=$(cat <<'END_HEREDOC'
_____ _
| _ |___| |_ _ _ ___ _ _ ___
| |_ -| '_| | | | . | | | _|
|__|__|___|_,_| |_ |___|___|_|
|___|
_ _
___ _ _ ___ ___| |_|_|___ ___
| . | | | -_|_ -| _| | . | |_
|_ |___|___|___|_| |_|___|_|_|_|
|_|
END_HEREDOC
);
fi
if [ -x "$(command -v lolcat)" ]; then
echo "${bold}${WAIT}${unbold}" | lolcat
sleep 2;
clear
echo "${bold}${NUMBER_3}${unbold}" | lolcat
sleep 1;
echo "${bold}${NUMBER_2}${unbold}" | lolcat
sleep 1;
echo "${bold}${NUMBER_1}${unbold}" | lolcat
sleep 1;
clear
echo "${bold}${ASK}${unbold}" | lolcat
else
echo "${bold}${WAIT}${unbold}"
sleep 2;
clear
echo "${bold}${NUMBER_3}${unbold}"
sleep 1;
echo "${bold}${NUMBER_2}${unbold}"
sleep 1;
echo "${bold}${NUMBER_1}${unbold}"
sleep 1;
clear
echo "${bold}${ASK}${unbold}"
fi
sleep 10;
clear
}
ask;

12
toys/color-parade.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
#
# Prints all the available colors with their code.
#
color=16;
while [ $color -lt 245 ]; do
echo -e "$color: \\033[38;5;${color}mhello\\033[48;5;${color}mworld\\033[0m"
((color++));
done

1008
toys/dna.sh Executable file

File diff suppressed because it is too large Load Diff

135
toys/fake-work.sh Executable file
View File

@ -0,0 +1,135 @@
#! /bin/bash
FAKER=$1;
if [ "$FAKER" = "hex" ]; then
while true; do head -c200 /dev/urandom | \
od -An -w50 -x | \
grep -E --color "([[:alpha:]][[:digit:]]){2}";
sleep 0.5;
done;
elif [ "$FAKER" = 'compile' ]; then
collect()
{
while read line; do
if [ -d "$line" ];then
(for i in "$line"/*;do echo $i;done)|sort -R|collect
echo $line
elif [[ "$line" == *".h" ]];then
echo $line
fi
done
}
sse="$(awk '/flags/{print;exit}' </proc/cpuinfo|grep -o 'sse\S*'|sed 's/^/-m/'|xargs)"
flags=""
pd="\\"
while true;do
collect <<< /usr/include|cut -d/ -f4-|
(
while read line;do
if [ "$(dirname "$line")" != "$pd" ];then
x=$((RANDOM%8-3))
if [[ "$x" != "-"* ]];then
ssef="$(sed 's/\( *\S\S*\)\{'"$x,$x"'\}$//' <<< "$sse")"
fi
pd="$(dirname "$line")"
opt="-O$((RANDOM%4))"
if [[ "$((RANDOM%2))" == 0 ]];then
pipe=-pipe
fi
case $((RANDOM%4)) in
0) arch=-m32;;
1) arch="";;
*) arch=-m64;;
esac
if [[ "$((RANDOM%3))" == 0 ]];then
gnu="-D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L "
fi
flags="gcc -w $(xargs -n1 <<< "opt pipe gnu ssef arch"|sort -R|(while read line;do eval echo \$$line;done))"
fi
if [ -d "/usr/include/$line" ];then
echo $flags -shared $(for i in /usr/include/$line/*.h;do cut -d/ -f4- <<< "$i"|sed 's/h$/o/';done) -o "$line"".so"
sleep $((RANDOM%2+1))
else
line=$(sed 's/h$//' <<< "$line")
echo $flags -c $line"c" -o $line"o"
sleep 0.$((RANDOM%4))
fi
done
)
done
elif [ "$FAKER" = 'code' ]; then
function randstatus() {
bsize=4096
r_rate=$(echo "$RANDOM/32767 * $bsize * 1.5 + $bsize / 4" | bc -l | sed 's/\..*$//')
r_min=2
r_max=4
r_val=$(($r_min + $RANDOM % $(($r_max - $r_min)) ))
i=0
dd if=/dev/urandom bs=$bsize count=$r_val 2> /dev/null \
| pv -L $bsize -s $(($r_val * bsize)) > /dev/null
}
function randout() {
r_file=$1;
#r_file=$(find $1 -name '*.php|*.js' | sort -R | head -n 1)
echo "# $r_file"
grep '^\s*/\*.*\*/\s*$' $r_file \
| sed 's:[/\*]::g' \
| sed -e 's:^\s\+::' -e 's:\s\+$::' \
| sed -e 's:^\W\+::' \
| grep -v '^$' \
| while read line; do
echo $line
sleep $(printf "%0.2f" $(echo "$((($RANDOM%4)+1))/4" | bc -l))
done
}
function randmessage() {
key=$(tr -dc A-Fa-f0-9 </dev/urandom | head -c 32);
random_number=$(( ( RANDOM % 10 ) + 1 )) # 1 to 10
restore='\033[0m';
if [ $random_number = 10 ]; then
msgs=("ERROR" "NOK" "CONNECTION FAILED");
color='\033[00;91m';
lcolor='\033[01;91m';
else
msgs=("OK" "DONE" "CREATED" "PASSED" "COMPLETE")
color='\033[00;92m';
lcolor='\033[01;92m';
fi
msg=${msgs[$RANDOM % ${#msgs[@]} ]};
msg=$(echo -e "${color}${msg}${lcolor}${restore}");
echo "$key - $msg"
echo ""
}
files=$(find $HOME -regex ".*/.*\.\(html\|yml\|toml\|cs\|c\|rb\|py\|xml\|rs\|js\|php\|css\)");
while true; do
randout $(echo "$files" | shuf -n 1);
randstatus
randmessage
sleep 2
done
else
echo ""
echo "USAGE:"
echo "$0 [hex|compile|code]"
echo ""
fi

129
toys/kaomoji.sh Executable file

File diff suppressed because one or more lines are too long

25
toys/labyrinth.sh Executable file
View File

@ -0,0 +1,25 @@
#! /bin/bash
# Produce a colorful maze
# Credit: https://mastodon.social/@climagic/103997167300219691
COLUMNS=$(tput cols);
if ! [ -x "$(command -v lolcat)" ]; then
grep -ao "[/\\]" /dev/urandom \
| sed -e 's,\\,╲,' -e 's,/,,' \
| tr -d \\n \
| while read -n $COLUMNS input ; do \
echo $input; \
sleep 0.2; \
done
else
grep -ao "[/\\]" /dev/urandom \
| sed -e 's,\\,╲,' -e 's,/,,' \
| tr -d \\n \
| while read -n $COLUMNS input ; do \
echo $input; \
sleep 0.2; \
done \
| lolcat
fi

58
toys/meme-composer.sh Executable file
View File

@ -0,0 +1,58 @@
#! /bin/bash
#
# Create your own memes.
#
USAGE="USAGE: $0 img.jpg 'top text' 'bottom text'";
if ! [ -x "$(command -v convert)" ]; then
echo "convert(1) is not installed. Install it and try again."
exit 1;
fi
if [ -x "$(command -v fc-list)" ]; then
if [ -z "$(fc-list | grep 'Impact')" ]; then
echo "Impact font not installed..."
fi
else
echo "Cannot check id Impact font is installed. Try installing fontconfig.";
fi
IMG_INPUT=$1;
IMG_OUTPUT="meme-$IMG_INPUT";
TEXT_TOP="";
TEXT_BOTTOM="";
if [ -z "$IMG_INPUT" ]; then
echo "$USAGE";
exit 1;
fi
if ! [ -z "$2" ]; then
TEXT_TOP=$2;
fi
if ! [ -z "$3" ]; then
TEXT_BOTTOM=$3;
fi
convert "$IMG_INPUT" \
-font impact \
-fill white \
-pointsize 84 \
-stroke black \
-strokewidth 3 \
-gravity north \
-annotate +0+20 \
"$TEXT_TOP" \
-gravity south \
-annotate +0+20 \
"$TEXT_BOTTOM" \
"$IMG_OUTPUT"
if [ -f "$IMG_OUTPUT" ]; then
echo "";
echo "Created $IMG_OUTPUT";
echo "";
fi

View File

@ -0,0 +1,23 @@
#! /bin/bash
# Gets the full range of combinations of a given number
#seq 1234 4321 | grep 1 | grep 2 | grep 3 | grep 4
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo "This command only accepts one input and it must be a number."
echo "";
echo "Example:";
echo "$0 1234"
exit 1;
fi
IN=$1;
REV_IN=$(echo $1 | rev);
PIPES="";
for ((i=0; i < ${#IN}; i++)); do
ARR[$i]=$((${IN:$i:1}));
PIPES="$PIPES | grep ${IN:$i:1}";
done
eval "seq $IN $REV_IN $PIPES";

77
toys/patxi.sh Executable file
View File

@ -0,0 +1,77 @@
#! /bin/bash
function patxi() {
FRAME4=$(cat <<'END_HEREDOC'
___ ___ ___ ___
/\ \ /\ \ /\ \ |\__\ ___
/::\ \ /::\ \ \:\ \ |:| | /\ \
/:/\:\ \ /:/\:\ \ \:\ \ |:| | \:\ \
/::\~\:\ \ /::\~\:\ \ /::\ \ |:|__|__ /::\__\
/:/\:\ \:\__\ /:/\:\ \:\__\ /:/\:\__\ ____/::::\__\ __/:/\/__/
\/__\:\/:/ / \/__\:\/:/ / /:/ \/__/ \::::/~~/~ /\/:/ /
\::/ / \::/ / /:/ / ~~|:|~~| \::/__/
\/__/ /:/ / \/__/ |:| | \:\__\
/:/ / |:| | \/__/
\/__/ \|__|
END_HEREDOC
);
FRAME2=$(cat <<'END_HEREDOC'
___ ___ ___
/\ \ /\ \ /| |
/::\ \ /::\ \ ___ |:| | ___
/:/\:\__\ /:/\:\ \ /\__\ |:| | /\__\
/:/ /:/ / /:/ /::\ \ /:/ / __|:|__| /:/__/
/:/_/:/ / /:/_/:/\:\__\ /:/__/ /::::\__\_____ /::\ \
\:\/:/ / \:\/:/ \/__/ /::\ \ ~~~~\::::/___/ \/\:\ \__
\::/__/ \::/__/ /:/\:\ \ |:|~~| ~~\:\/\__\
\:\ \ \:\ \ \/__\:\ \ |:| | \::/ /
\:\__\ \:\__\ \:\__\ |:|__| /:/ /
\/__/ \/__/ \/__/ |/__/ \/__/
END_HEREDOC
);
FRAME3=$(cat <<'END_HEREDOC'
___ ___ ___
/ /\ / /\ ___ /__/| ___
/ /::\ / /::\ / /\ | |:| / /\
/ /:/\:\ / /:/\:\ / /:/ | |:| / /:/
/ /:/~/:/ / /:/~/::\ / /:/ __|__|:| /__/::\
/__/:/ /:/ /__/:/ /:/\:\ / /::\ /__/::::\____ \__\/\:\__
\ \:\/:/ \ \:\/:/__\/ /__/:/\:\ ~\~~\::::/ \ \:\/\
\ \::/ \ \::/ \__\/ \:\ |~~|:|~~ \__\::/
\ \:\ \ \:\ \ \:\ | |:| /__/:/
\ \:\ \ \:\ \__\/ | |:| \__\/
\__\/ \__\/ |__|/
END_HEREDOC
);
FRAME1=$(cat <<'END_HEREDOC'
___ __
___ / /\ ___ | |\ ___
/ /\ / /::\ /__/\ | |:| /__/\
/ /::\ / /:/\:\ \ \:\ | |:| \__\:\
/ /:/\:\ / /::\ \:\ \__\:\ |__|:|__ / /::\
/ /::\ \:\ /__/:/\:\_\:\ / /::\ ____/__/::::\ __/ /:/\/
/__/:/\:\_\:\ \__\/ \:\/:/ / /:/\:\ \__\::::/~~~~ /__/\/:/~~
\__\/ \:\/:/ \__\::/ / /:/__\/ |~~|:| \ \::/
\ \::/ / /:/ /__/:/ | |:| \ \:\
\__\/ /__/:/ \__\/ |__|:| \__\/
\__\/ \__\|
END_HEREDOC
);
clear
for i in {0..10}
do
echo "${FRAME2}"
echo "${FRAME1}"
sleep 1
clear
echo "${FRAME3}"
echo "${FRAME4}"
sleep 1
clear
done
clear
}
patxi

20
toys/pingpong.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
#
# Draws a ping pong cursor what prints out the contents of "man bash" or any other stdout it gets piped.
#
# Uses:
# $ pingpong.sh echo "My very long string"
# $ pingpong.sh cat path/to/text/file
#
ARGS=$@;
LINES=$(tput lines)
COLUMNS=$(tput cols)
AWK_MAGIC='BEGIN{x=y=e=f=1}{if(x==mx||!x){e*=-1};if(y==my||!y){f*=-1};x+=e;y+=f;printf "\033[%s;%sH%s",y,x,$1;for (a=0;a<400000;a++){}}';
if [ $# -eq 0 ]; then ARGS='man bash'; fi
bash -c "$ARGS" \
| sed 's/./&\n/g' \
| awk -v mx=$COLUMNS -v my=$LINES "$AWK_MAGIC"

38
toys/snake.sh Executable file
View File

@ -0,0 +1,38 @@
#! /bin/bash
eset;
clear;
COLUMNS=$(tput cols);
LINES=$(tput lines);
x=$[COLUMNS/2];
y=$LINES;
u=0;
v=-1;
while :;do read -sr -t0.02 -n3 d;
case "${d:2:1}" in
A) v=-1;
u=0
;;
B) v=1;
u=0
;;
C) v=0;
u=1
;;
D) v=0;
u=-1
;;
esac;
s=$x;
t=$y;
x=$[x+u];
y=$[y+v];
printf "\033[%s;%sH\033[46m \033[0m\033[%s;%sH\033[44m \033[0m\033[0;0H" $y $x $t $s;
sleep .01;
done

47
toys/splaining.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
#
# See man Splaining for more information
#
if ! [ -f "/usr/local/man/man1/splaining.1" ]; then
mkdir -p "/usr/local/man/man1"
cat << EOF > "/tmp/splaining.1"
.\" Manpage for splaining.
.\" You are about to be advised about something you already know in a condescending manner.
.TH man 8 "05 July 2020" "1.0" "splaining man page"
.SH NAME
splaining \- Free useless advice
.SH SYNOPSIS
splaining
.SH DESCRIPTION
The splaining(0) command is an obnoxious command that assumes you have no idea about what you are doing. Definition of mansplaining:
n. Explaining (something) in a condescending or self-righteous manner, especially as a man to a woman.
.SH OPTIONS
The splaining command does not take any options or arguments. However, it will always assume you are wrong.
.SH SEE ALSO
mansplanation(8), womansplaining(5)
.SH BUGS
No known bugs. If any re found assume the flaws are obviously yours.
.SH AUTHOR
Manny Splainer
EOF
echo "Attempting to install man page."
sudo install -g 0 -o 0 -m 0644 "/tmp/splaining.1" "/usr/local/man/man1/"
sudo gzip "/usr/local/man/man1/splaining.1"
fi
declare -a splains=(
"Did you read the man page? It explains things you know."
"Here's a fun fact; feminine vote was invented by Mussolini"
"That's because the word \"sexist\" has been overused by the media."
# Add your mansplaining quotes here.
)
echo ""
echo ${splains["$[RANDOM % ${#splains[@]}]"]};
echo "For more information type:"
echo " man splaining"
echo
echo ""

20
toys/typewritter.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
## Apply a silly typing effect to whatever the input is.
if [ $# -eq 0 ]
then
echo "No arguments supplied."
echo "What do you want to type?"
read text
else
text="$*"
fi
for (( i=0; i<${#text}; i++ )); do
echo -ne "${text:$i:1}"
sleep 0.1
done
echo ""; # add newline at the end
exit 1;