Add 2012/grothe/try.sh + format/typo checks

And since the try.sh scrambles and descrambles a cookie recipe I will
offer this funny story from decades ago that my mum tells every so
often: my uncle, who lived with my parents, and my father were at home
and they made 12 dozen cookies. They called my mum at her work and told
her: we made twelve dozen cookies and we saved you one! My mum thought
they meant she saved them one dozen cookies, already suggesting they had
eaten too many. But no. They left her one cookie! The reason is they
couldn't get the milk and cookies balanced so the only obvious thing to
do was to eat 143 cookies.  Obviously. They were quite sick and nobody
was sympathetic to their ridiculous stunt.

So let that be a lesson to anyone who decides they want to eat 143
cookies: just eat 142 and you'll be just fine, weight gain
notwithstanding! :-) (Okay maybe keep it at 24 .. unless they're
chocolate in which case you might want to eat three, four, five, however
many dozen you can fit in your stomach.)

Only the last paragraph is not sincere. The first really did happen.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-02 10:08:55 -08:00
1 parent b79a7c1079
commit 75ac0752ed
9 files changed
+65 -21

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2000/tomx
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
read -r -n 1 -p "Press any key to break recipe into crumbs: "
echo 1>&2
echo "$ ./grothe -cookie_recipe.txt 1-/dev/urandom 2-/dev/urandom \\
1+cookie_piece1.dat 2+cookie_piece2.dat 3+cookie_piece3.dat 4+cookie_piece4.dat"
echo 1>&2
read -r -n 1 -p "Press any key to restore cookie recipe: "
echo 1>&2
echo "$ ./grothe 1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat +cookie_recipe_restore.txt" 1>&2
echo 1>&2
read -r -n 1 -p "Press any key to show that the two files are the same: "
echo 1>&2
diff -s cookie_recipe.txt cookie_recipe_restore.txt
echo 1>&2
read -r -n 1 -p "Press any key to see the recipe file, restored: "
echo 1>&2
cat cookie_recipe_restore.txt