Merge pull request #1987 from xexyl/anonymous04-try

Add 2004/anonymous/try.sh
This commit is contained in:
Landon Curt Noll authored and GitHub committed 2024-01-20 19:51:26 -08:00
commit e14325556c
9 files changed
+139 -31

No files matched your search

+2
View File
@@ -8,5 +8,7 @@ indent
indent.c indent.c
indent.o indent.o
precious.pgm precious.pgm
precious.jpg
prog.orig prog.orig
ring.pgm ring.pgm
ring.jpg
+5 -7
View File
@@ -22,14 +22,11 @@ images.
## Try: ## Try:
```sh ```sh
./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \ ./try.sh
ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm
./anonymous "My Precious. Yes, my Precious." > precious.pgm
``` ```
NOTE: technically the text is supposed to be in all lower case but the above NOTE: technically the text is supposed to be in all lower case but the script
still works for demonstration purposes. does use some upper case letters for demonstration purposes.
## Judges' remarks: ## Judges' remarks:
@@ -55,13 +52,14 @@ Hobbit](https://tolkiengateway.net/wiki/The_History_of_The_Hobbit).
p.s. Frodo lives! p.s. Frodo lives!
### An important aside :-) ### An important aside :-)
BTW: if you haven't read [The Lord of the BTW: if you haven't read [The Lord of the
Rings](https://en.wikipedia.org/wiki/The_Lord_of_the_Rings) what are you waiting for? :-) Rings](https://en.wikipedia.org/wiki/The_Lord_of_the_Rings) what are you waiting for? :-)
You'll find out the source of the text above though you'll see that there are You'll find out the source of the text above though you'll see that there are
some circumflexes missing! That's okay though due to I/O of the entry and in some circumflexes missing! That's okay though due to I/O of the entry and in
earlier drafts sometimes the û with an umlaut had no umlaut but H after the `u` earlier drafts sometimes the û had no diacritic but H after the `u` in
it. The real text is: it. The real text is:
> Ash nazg durbatulûk, ash nazg gimbatul, ash nazg thrakatulûk, agh > Ash nazg durbatulûk, ash nazg gimbatul, ash nazg thrakatulûk, agh
+55
View File
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
#
# try.sh - demonstrate IOCCC winner 2001/anonymous
#
# 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
# clear screen after compilation so that only the entry is shown
clear
# see if we have convert(1)
#
CONVERT="$(type -P convert)"
echo "$ ./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm" 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
./anonymous "ash nazg durhbatuluhk, ash nazg gimbatul, \
ash nazg thrakatuluhk, agh burzhumh-ishi krimpatul." >ring.pgm
if [[ -n "$CONVERT" ]]; then
"$CONVERT" ring.pgm ring.jpg
echo "Now open ring.jpg in a graphics viewer, editor or web browser." 1>&2
echo "If you don't recognise it you should read The Lord of the Rings" 1>&2
echo "immediately. Don't worry! It's not that long. It's only 1031 pages," 1>&2
echo "my Precious, yes. :-)" 1>&2
else
echo "Now open ring.pgm in a graphics viewer capable of reading Netpbm graphics." 1>&2
echo "Alternatively, install ImageMagick and try running this script again." 1>&2
echo "Once you've done so, if you don't recognise this image, you should read The" 1>&2
echo "Lord of the Rings immediately. Don't worry! It's not that long. It's only 1031" 1>&2
echo "pages, my Precious, yes. :-)" 1>&2
fi
echo 1>&2
read -r -n 1 -p "Press any key to run: ./anonymous \"My Precious. Yes, my Precious.\" > precious.pgm: "
echo 1>&2
./anonymous "My Precious. Yes, my Precious." > precious.pgm
if [[ -n "$CONVERT" ]]; then
"$CONVERT" precious.pgm precious.jpg
echo "Now open precious.jpg in a graphics viewer, editor or web browser." 1>&2
else
echo "Now open precious.pgm in a graphics viewer capable of reading Netpbm graphics." 1>&2
echo "Alternatively, install ImageMagick and try running this script again." 1>&2
fi
+1 -1
View File
@@ -15,7 +15,7 @@ make
## Try: ## Try:
``` ```
./omoikane omoikane.info omoikane.info omoikane.output ./try.sh
``` ```
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
read -r -n 1 -p "Press any key to run: ./omoikane omoikane.info omoikane.info omoikane.output: "
echo 1>&2
./omoikane omoikane.info omoikane.info omoikane.output
echo 1>&2
exit 0
+12 -5
View File
@@ -15,12 +15,19 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown # clear screen after compilation so that only the entry is shown
clear clear
# check for vi in the unlikely case it's not installed
#
if [[ -z "$(type -P vi)" ]]; then
echo "$0: vi not installed, cannot proceed." 1>&2
exit 1
fi
echo "$ ./schnitzi <schnitzi.inp0 | vi -n" 1>&2 read -r -n 1 -p "Press any key to run: ./schnitzi <schnitzi.inp0 | vi -n: "
echo 1>&2
./schnitzi <schnitzi.inp0 | vi -n ./schnitzi <schnitzi.inp0 | vi -n
echo 1>&2
read -r -n 1 -p "Press any key to continue: " read -r -n 1 -p "Press any key to run: ./schnitzi <schnitzi.inp1 | vi -n: "
echo echo 1>&2
echo "$ ./schnitzi <schnitzi.inp1 | vi -n" 1>&2
./schnitzi <schnitzi.inp1 | vi -n ./schnitzi <schnitzi.inp1 | vi -n
echo 1>&2
+37 -18
View File
@@ -15,41 +15,60 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown # clear screen after compilation so that only the entry is shown
clear clear
echo "$ ./sds < sds.c > encoder.c" 1>&2 read -r -n 1 -p "Press any key to show sds.c (space = next page, q = quit): "
./sds < sds.c > encoder.c echo 1>&2
less -rEXF sds.c
echo 1>&2 echo 1>&2
echo "$ make encoder 2>/dev/null" 1>&2 read -r -n 1 -p "Press any key to run: ./sds < sds.c | tee encoder.c (space = next page, q = quit): "
echo 1>&2
./sds < sds.c | tee encoder.c | less -rEXF
echo 1>&2
read -r -n 1 -p "Press any key to run: make encoder 2>/dev/null: "
echo 1>&2
make encoder 2>/dev/null make encoder 2>/dev/null
echo 1>&2 echo 1>&2
echo "$ ./encoder README.md <sds.c >sds_msg.c" echo "$ ./encoder README.md <sds.c | tee sds_msg.c" 1>&2
./encoder README.md <sds.c >sds_msg.c read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./encoder README.md <sds.c | tee sds_msg.c | less -rEXF
echo "$ make sds_msg 2>/dev/null" 1>&2 read -r -n 1 -p "Press any key to run: make sds_msg 2>/dev/null: "
echo 1>&2
make sds_msg 2>/dev/null make sds_msg 2>/dev/null
echo 1>&2 echo 1>&2
echo "$ ./sds_msg < sds.c > sds2_msg.c" 1>&2 echo "$ ./sds_msg < sds.c | tee sds2_msg.c | less -rEXF" 1>&2
./sds_msg < sds.c > sds2_msg.c read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./sds_msg < sds.c | tee sds2_msg.c | less -rEXF
echo "$ diff sds2_msg.c encoder.c" 1>&2 read -r -n 1 -p "Press any key to run: diff -s sds2_msg.c encoder.c: "
diff sds2_msg.c encoder.c echo 1>&2
diff -s sds2_msg.c encoder.c
echo 1>&2
echo "$ echo 'Hello, World!' > message" 1>&2 read -r -n 1 -p "Press any key to run: echo 'Hello, World!' > message: "
echo 1>&2
echo 'Hello, World!' > message echo 'Hello, World!' > message
echo 1>&2
echo "$ ./encoder message < README.md > remarks.md" 1>&2 echo "$ ./encoder message < README.md | tee remarks.md" 1>&2
./encoder message < README.md > remarks.md read -r -n 1 -p "Press any key to continue (space = next page, q = quit): "
echo 1>&2
./encoder message < README.md | tee remarks.md | less -rEXF
echo 1>&2
read -r -n 1 -p "Press any key to show diff remarks.md README.md: " read -r -n 1 -p "Press any key to run: diff remarks.md README.md: "
echo "$ diff remarks.md README.md" 1>&2 echo 1>&2
diff remarks.md README.md # notice how similar they are diff remarks.md README.md # notice how similar they are
echo "Did you notice how similar they are?" 1>&2 echo "Did you notice how similar they are?" 1>&2
echo 1>&2 echo 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
# and then observe: # and then observe:
echo "$ ./sds < remarks.md" 1>&2 read -r -n 1 -p "Press any key to run: ./sds < remarks.md: "
echo 1>&2
./sds < remarks.md ./sds < remarks.md
echo 1>&2
+7
View File
@@ -16,13 +16,20 @@ make
```sh ```sh
./vik1 ./vik1
./vik1 a ./vik1 a
./vik1 d2 ./vik1 d2
./vik1 ad3 ./vik1 ad3
``` ```
Can you figure out how to cheat? Can you figure out how to cheat?
Also see the author's remarks below for more details on the different
modes/options.
## Judges' remarks: ## Judges' remarks:
+12
View File
@@ -2923,6 +2923,11 @@ described in the README.md, based on the author's remarks.
# <a name="2004"></a>2004 # <a name="2004"></a>2004
## <a name="2004_anonymous"></a>[2004/anonymous](/2004/anonymous/anonymous.c) ([README.md](/2004/anonymous/README.md]))
[Cody](#cody) added the [try.sh](/2004/anonymous/try.sh) script.
## <a name="2004_arachnid"></a>[2004/arachnid](/2004/arachnid/arachnid.c) ([README.md](/2004/arachnid/README.md])) ## <a name="2004_arachnid"></a>[2004/arachnid](/2004/arachnid/arachnid.c) ([README.md](/2004/arachnid/README.md]))
[Cody](#cody) added an [alternate version](/2004/arachnid/README.md#alternate-code) which [Cody](#cody) added an [alternate version](/2004/arachnid/README.md#alternate-code) which
@@ -3068,6 +3073,11 @@ that the author referred to and was documented by [Yusuke](#yusuke) though Cody
chose the word `IOCCC` instead of `AAA`). chose the word `IOCCC` instead of `AAA`).
## <a name="2004_omoikane"></a>[2004/omoikane](/2004/omoikane/omoikane.c) ([README.md](/2004/omoikane/README.md]))
[Cody](#cody) added the [try.sh](/2004/omoikane/try.sh) script.
## <a name="2004_schnitzi"></a>[2004/schnitzi](/2004/schnitzi/schnitzi.c) ([README.md](/2004/schnitzi/README.md])) ## <a name="2004_schnitzi"></a>[2004/schnitzi](/2004/schnitzi/schnitzi.c) ([README.md](/2004/schnitzi/README.md]))
[Cody](#cody) made this use `fgets(3)`. [Cody](#cody) made this use `fgets(3)`.
@@ -3076,6 +3086,8 @@ He also changed the time factor in the data files as the animations went too
fast in modern systems, especially the scrolling text of fast in modern systems, especially the scrolling text of
[schnitzi.inp1](schnitzi.inp1). [schnitzi.inp1](schnitzi.inp1).
Cody also added the [try.sh](/2004/schnitzi/try.sh) script.
## <a name="2004_sds"></a>[2004/sds](/2004/sds/sds.c) ([README.md](/2004/sds/README.md)) ## <a name="2004_sds"></a>[2004/sds](/2004/sds/sds.c) ([README.md](/2004/sds/README.md))