improve how markdown code language is commented
We added a space between the markdown triple code mark and language that was enclosed in HTML comments. So a line of the form: ```` ```<!---c---> ```` became: ```` ``` <!---c---> ```` This was done to **help** some code see that the HTML comment string was not a markdown code specifier. Not all code understands this after this changed. For example, `pandoc(1)` still forms HTML classes of the form "<!---c-->" when it encounters the above mentioned change. We also fixed a problem with `2019/dogon/README.md` regarding a markdown code block. We also fixed a problem with `2020/yang/README.md` regarding a markdown code block.
This commit is contained in:
1 parent
c549f6585e
commit
3ddbac9e6b
357 files changed
+2432
-2399
No files matched your search
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,14 +18,14 @@ For more detailed information see [2012 blakely bugs](../../bugs.html#2012_blake
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./blakely "RPN formula" resolution > output.gif
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -59,7 +59,7 @@ output to `stdout`.
|
||||
|
||||
The program should be run as:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./blakely xy* 32 > pic.gif
|
||||
```
|
||||
|
||||
@@ -105,7 +105,7 @@ resolution of `ripple.gif`
|
||||
to 250 took ~35 minutes to render on an [i7
|
||||
processor](https://en.wikipedia.org/wiki/Intel_Core#Core_i7).
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./blakely xy* 32 > saddle.gif
|
||||
|
||||
./blakely xx*yy*1++d5*ct/ 64 > ripple.gif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,14 +18,14 @@ For more detailed information see [2012 deckmyn bugs](../../bugs.html#2012_deckm
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./deckmyn "$(cat deckmyn.c)" "$(cat musicfile.txt)" > sheetmusic.pbm
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -59,13 +59,13 @@ You need the source code and example input (either one of the example files, or
|
||||
manual input as below) ready and a program capable of showing [.pbm bitmap
|
||||
format](https://en.wikipedia.org/wiki/Netpbm) images.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./deckmyn "`cat deckmyn.c`" "`cat example_greensleeves`" > greensleeves.pbm
|
||||
```
|
||||
|
||||
If you have macOS you can open the image like:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
open greensleeves.pbm
|
||||
```
|
||||
|
||||
@@ -73,13 +73,13 @@ If you have macOS you can open the image like:
|
||||
normally open an image.
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./deckmyn "`cat deckmyn.c`" "KF m44c4 c4 g4 g4 : a4 a4 g2 :; " > short_bass.pbm
|
||||
```
|
||||
|
||||
If you have macOS you can open the image like:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
open short_bass.pbm
|
||||
```
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
## Calling the program
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./deckmyn "`cat deckmyn.c`" "`cat musicfile`" > output.pbm
|
||||
```
|
||||
|
||||
@@ -85,7 +85,7 @@ musical element of a line is only 2 characters!
|
||||
|
||||
Blank music paper (with G clef):
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./deckmyn "`cat deckmyn.c`" "sz sa x s1 x s1 x s1 x s1 x s1 "> blank.pbm
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -18,14 +18,14 @@ For more detailed information see [2012 dlowe bugs](../../bugs.html#2012_dlowe).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./dlowe
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./dlowe
|
||||
```
|
||||
|
||||
|
||||
+15
-15
@@ -1,5 +1,5 @@
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -14,7 +14,7 @@ section below for more details.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./endoh1 < file
|
||||
```
|
||||
|
||||
@@ -25,7 +25,7 @@ see what this looks like not going so fast then you might wish to try the
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.bw.sh endoh1.c
|
||||
./try.sh endoh1.c
|
||||
|
||||
@@ -50,7 +50,7 @@ the fluid and change the behaviour of the fluid. The file
|
||||
|
||||
For the default values, try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -59,13 +59,13 @@ one can more easily go through the list of files to see them all in succession,
|
||||
for fun. That is controlled by the variable `TIMER` at compilation.
|
||||
For instance if you wish to change the value to 5:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber TIMER=5 alt
|
||||
```
|
||||
|
||||
If you want to disable the alarm time, set it to 0:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber TIMER=0 alt
|
||||
```
|
||||
|
||||
@@ -76,7 +76,7 @@ see and to not flash too quickly. The code protects against a value < 0 and
|
||||
defaults to 12321 but you can change it to. For instance to slow it down you
|
||||
could increase the sleep time from `12321` to `50000`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber SLEEP=50000 alt
|
||||
```
|
||||
|
||||
@@ -84,7 +84,7 @@ could increase the sleep time from `12321` to `50000`:
|
||||
If you wish to speed it up you might decrease the sleep time from `12321` to
|
||||
`9999`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber SLEEP=9999 alt
|
||||
```
|
||||
|
||||
@@ -97,7 +97,7 @@ viscosity factor, you should redefine the values `GRAVITY`, `PRESSURE` and/or
|
||||
`VISCOSITY` macros, respectively. For instance if you wish to change the
|
||||
viscosity and pressure factors but leave the other values alone:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber VISCOSITY=X PRESSURE=Y alt
|
||||
```
|
||||
|
||||
@@ -111,13 +111,13 @@ You might also wish to try redefining the macros `G`, `P` and/or `V`. For
|
||||
instance:
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber GRAVITY=5 PRESSURE=5 VISCOSITY=5 alt
|
||||
```
|
||||
|
||||
You might try even:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber GRAVITY=I alt
|
||||
```
|
||||
|
||||
@@ -141,7 +141,7 @@ and `endoh1_color` above.
|
||||
To see two different ways run on the source file and each of the text files,
|
||||
try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
@@ -149,7 +149,7 @@ The second run of each will be with the gravity factor set to `I`.
|
||||
|
||||
To see the same thing but in the original uncoloured version, try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.bw.sh
|
||||
```
|
||||
|
||||
@@ -178,7 +178,7 @@ entry](https://web.archive.org/web/20230711134609/https://whatif.xkcd.com/6/).
|
||||
**DO NOT FORGET** `-DG=1 -DP=4 -DV=8` and make your terminal window larger
|
||||
than 80 x 25.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc endoh1.c -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -o endoh1 -lm
|
||||
./endoh1 < endoh1.c
|
||||
./endoh1 < logo.txt
|
||||
@@ -246,7 +246,7 @@ to build with no warning. Under these conditions, it should be portable.
|
||||
At least, recent compilers with `-std=c99 -Wall -W -Wextra -pedantic` say
|
||||
nothing.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
gcc -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c
|
||||
|
||||
clang -DG=1 -DP=4 -DV=8 -D_BSD_SOURCE -std=c99 -Wall -W -Wextra -pedantic endoh1.c
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./endoh2 > pi.c
|
||||
gcc -o pi pi.c
|
||||
./pi > 314.c
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
and:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./endoh2 e > e.c\
|
||||
gcc -o e e.c
|
||||
./e > 271.c
|
||||
@@ -26,7 +26,7 @@ and:
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -112,7 +112,7 @@ characters and not requiring a return in `main()`. In fact, recent compilers
|
||||
with `-std=c99 -Wall -W -Wextra -pedantic` would say nothing.
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
gcc -std=c99 -Wall -W -Wextra -pedantic spigot.c
|
||||
clang -std=c99 -Wall -W -Wextra -pedantic spigot.c
|
||||
```
|
||||
@@ -123,7 +123,7 @@ and gcc-4.5.3 and clang-3.1 on Cygwin.
|
||||
|
||||
### Synopsis
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cc endoh2.c -o endoh2
|
||||
|
||||
./endoh2 > pi.c
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
To create a shared secret shared among `M` people with `N+1` needed to reconstruct:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./grothe -secret 1-/dev/urandom 2-/dev/urandom ... \
|
||||
N-/dev/urandom 1+shared1 2+shared2 ... M+sharedM
|
||||
```
|
||||
@@ -17,14 +17,14 @@ To create a shared secret shared among `M` people with `N+1` needed to reconstru
|
||||
To reconstruct the original (an arbitrary combination of `N+1` or
|
||||
more shared files with their proper numbers):
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./grothe I-sharedI J-sharedJ K-sharedK ... +reconstructed
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -75,7 +75,7 @@ To share a secret. For example:
|
||||
To split a secret into 4 pieces of which at least 3 will be needed to get it (in
|
||||
this case the cookie recipe) back:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./grothe \
|
||||
-cookie_recipe.txt\
|
||||
1-/dev/urandom 2-/dev/urandom\
|
||||
@@ -84,7 +84,7 @@ this case the cookie recipe) back:
|
||||
|
||||
To put the recipe back together using the first, second and fourth pieces:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./grothe \
|
||||
1-cookie_piece1.dat 2-cookie_piece2.dat 4-cookie_piece4.dat
|
||||
+cookie_recipe_restore.txt
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./hamano < textfile > output.pdf
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -30,7 +30,7 @@ README.md!
|
||||
|
||||
That procedure looks like:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./hamano < README.md > hint.pdf
|
||||
cc -xc hint.pdf -o hint
|
||||
./hint
|
||||
@@ -40,7 +40,7 @@ Another PDF generated is an obfuscated `Hello World!` program (obfuscated inside
|
||||
the PDF). Once this is done it will compile the PDF as if it was C (itself!). It
|
||||
will look like:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
echo 'int main(){puts("Hello World!");}' | ./hamano > hello.pdf
|
||||
cc -xc hello.pdf -o hello
|
||||
./hello | cc -Wno-implicit-function-declaration -xc - -o ./hello2
|
||||
|
||||
+5
-5
@@ -1,20 +1,20 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./hou syntax-file file-to-process
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -80,7 +80,7 @@ The following regular expression operators are supported:
|
||||
For example, one can use the following expression to match a certain declaration
|
||||
statement in [hou.c](hou.c):
|
||||
|
||||
```<!---re-->
|
||||
``` <!---re-->
|
||||
"char"[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*(,[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*)*;
|
||||
```
|
||||
|
||||
@@ -89,7 +89,7 @@ The regex engine is also algorithmically efficient. To illustrate the point,
|
||||
hang for the competing Perl engine while matching itself. Try to compare these
|
||||
two engines:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./hou ansi.txt ansi.txt
|
||||
perl patho.pl < ansi.txt
|
||||
```
|
||||
|
||||
+4
-4
@@ -2,13 +2,13 @@
|
||||
|
||||
### To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make hou
|
||||
```
|
||||
|
||||
### To run:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./hou syntax-file file-to-process
|
||||
```
|
||||
|
||||
@@ -81,7 +81,7 @@ The following regular expression operators are supported:
|
||||
|
||||
For example, one can use the following expression to match a certain declaration statement in hou.c:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
"char"[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*(,[ *]*[a-zA-Z_][0-9a-zA-Z_]*[ ]*((=[0-9a-zA-Z_ ]+)|(\[[0-9a-zA-Z_ ]*\]))?[ ]*)*;
|
||||
```
|
||||
|
||||
@@ -89,7 +89,7 @@ The regex engine is also algorithmically efficient. To illustrate the point,
|
||||
ansi.txt contains a pathological expression [2] that guarantees a hang for the
|
||||
competing Perl engine while matching itself. Try to compare these two engines:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./hou ansi.txt ansi.txt
|
||||
perl patho.pl < ansi.txt
|
||||
```
|
||||
|
||||
+8
-8
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -10,14 +10,14 @@ See [Alternate code](#alternate-code) below for the (fun) rationale here.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh # try various languages
|
||||
|
||||
./en.sh # English 0 through 13
|
||||
@@ -43,14 +43,14 @@ subtlety of this entry even more.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
|
||||
### Alternate use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
echo "full spelling of an English cardinal numeral less than a quadrillion" | ./kang.alt
|
||||
|
||||
echo vier | ./kang.alt
|
||||
@@ -61,7 +61,7 @@ subtlety of this entry even more.
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.sh # try various languages
|
||||
|
||||
./en.alt.sh # English 0 through 13
|
||||
@@ -88,13 +88,13 @@ We've added a linefeed to the print format for convenience.
|
||||
|
||||
Can you explain why:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
echo f hundr|./kang
|
||||
```
|
||||
|
||||
correctly reports 500 but:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
echo hundr|./kang
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -10,14 +10,14 @@ code](#alternate-code) below.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./konno N
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
|
||||
# you can also specify numbers to try before the random and preselected ones:
|
||||
@@ -36,7 +36,7 @@ This alternate code is an unobfuscated version of the winning code.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -64,7 +64,7 @@ patterns.
|
||||
|
||||
Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./konno 30
|
||||
./konno 90
|
||||
./konno 102
|
||||
@@ -79,13 +79,13 @@ There are 256 (from 0 through 255) possible rules.
|
||||
|
||||
This program uses bit operations. I think
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
7&O<<!o>>!o+29
|
||||
```
|
||||
|
||||
is an interesting operation. This isn't equal to
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
7&O>>29
|
||||
```
|
||||
|
||||
|
||||
+10
-10
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -12,7 +12,7 @@ theoretically work with Windows which distinguishes binary and text. See
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./nyaruko [seed.txt] < original.bin > output.c
|
||||
bash output.c > key.c
|
||||
perl output.c > data.c
|
||||
@@ -30,7 +30,7 @@ binary itself.
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -53,13 +53,13 @@ binary mode on `stdin` and `stdout`.
|
||||
For the first version:
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
For the second version:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt2
|
||||
```
|
||||
|
||||
@@ -73,7 +73,7 @@ Use `nyaruko.alt` or `nyaruko.alt2` as you would `nyaruko` above.
|
||||
|
||||
For the first alternate version:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
@@ -93,7 +93,7 @@ The judges have nothing to add that has not already been written about in the
|
||||
`Nyaruko` is a binary to text filter. Given some input on `stdin`,
|
||||
`Nyaruko` will produce C code that reproduces this input on `stdout`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./nyaruko < original.bin > output.c
|
||||
gcc output.c -o output
|
||||
./output > regenerated.bin
|
||||
@@ -102,7 +102,7 @@ The judges have nothing to add that has not already been written about in the
|
||||
Output is encrypted, but both key and data are included in the output.
|
||||
To separate the key from the data, run these commands:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
bash output.c > key.c
|
||||
perl output.c > data.c
|
||||
```
|
||||
@@ -114,7 +114,7 @@ why the code is formatted the way it is.
|
||||
To combine the key and data, concatenate them together in either
|
||||
order:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cat key.c data.c > output.c
|
||||
cat data.c key.c > output.c
|
||||
```
|
||||
@@ -123,7 +123,7 @@ By default, `Nyaruko` generates a unique random key for every message,
|
||||
using `/dev/urandom` as the seed. If given an extra command line
|
||||
argument, `Nyaruko` will seed using that file instead of `/dev/urandom`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./nyaruko seed.txt < input.bin > output.c
|
||||
```
|
||||
|
||||
|
||||
+19
-19
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make all # On a 64-bit machine (default)
|
||||
|
||||
make tromp32 # On a 32-bit machine
|
||||
@@ -20,7 +20,7 @@ For more detailed information see [2012 tromp bugs](../../bugs.html#2012_tromp).
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./tromp [-b]
|
||||
```
|
||||
|
||||
@@ -29,7 +29,7 @@ Use `./tromp32` as you would `./tromp` if on a 32-bit machine.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cat ascii-prog.blc data | ./tromp -b
|
||||
cat binary-prog.Blc data | ./tromp
|
||||
```
|
||||
@@ -37,7 +37,7 @@ Use `./tromp32` as you would `./tromp` if on a 32-bit machine.
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -113,7 +113,7 @@ identity function. When its encoding `0010` is fed into the universal machine,
|
||||
it will simply copy the input to the output (well, not that simply, since each
|
||||
byte is smashed to bits and rebuilt from scratch). Voila: a half byte cat:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo " Hello, world" | ./tromp
|
||||
Hello, world
|
||||
```
|
||||
@@ -122,7 +122,7 @@ Since the least significant 4 bits of the first byte are just arbitrary padding
|
||||
that is ignored by the program, any character from ASCII 32 (space) through 47
|
||||
(`/`) will do, e.g.:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo "*Hello, world" | ./tromp
|
||||
Hello, world
|
||||
```
|
||||
@@ -134,7 +134,7 @@ If the input doesn't start with a valid program, that is,
|
||||
if the interpreter reaches end-of-file during program parsing,
|
||||
it will crash in some way. E.g. the following might dump core:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
echo -n "U" | ./tromp
|
||||
```
|
||||
|
||||
@@ -143,7 +143,7 @@ closed, that is, variable `n` can only appear within at least `n` enclosing
|
||||
lambdas. For instance, here the term `\ 5` is not closed, causing the
|
||||
interpreter to crash when looking into a null-pointer environment:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
echo ">Hello, world" | ./tromp
|
||||
```
|
||||
|
||||
@@ -200,7 +200,7 @@ The byte oriented BLC8 version weighs in at 43 bytes (shown in hexadecimal).
|
||||
|
||||
```
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ (cat uni8.Blc; echo " Ni hao") | ./tromp
|
||||
Ni hao
|
||||
```
|
||||
@@ -225,7 +225,7 @@ Even shorter than the self-interpreter is this prime number sieve in 167 bits
|
||||
|
||||
The `n`th bit in the output indicates whether n is prime:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ cat primes.blc | ./tromp -b | head -c 70
|
||||
0011010100010100010100010000010100000100010100010000010000010100000100
|
||||
```
|
||||
@@ -265,7 +265,7 @@ The program `hilbert.Blc`, at 143 bytes, is a very twisty "one-liner" (shown in
|
||||
It expects `n` arbitrary characters of input, and draws a space filling [Hilbert
|
||||
curve](https://en.wikipedia.org/wiki/Hilbert_curve) of order `n`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ (cat hilbert.Blc; echo -n "1") | ./tromp
|
||||
_
|
||||
| |
|
||||
@@ -344,7 +344,7 @@ Writing BLC programs can be made slightly less painful with this parser that
|
||||
translates single-letter-variable lambda calculus into BLC:
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo "\f\x f (f (f x))" > three
|
||||
$ cat parse.Blc three | ./tromp
|
||||
000001110011100111010
|
||||
@@ -358,21 +358,21 @@ into BLC8:
|
||||
|
||||
So we could assemble an input reversing program as
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
echo "\a a ((\b b b) (\b \c \d \e d (b b) (\f f c e))) (\b \c c)" > reverse
|
||||
cat parse.Blc reverse | ./tromp > reverse.blc
|
||||
```
|
||||
|
||||
and change it to BLC8 with
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ cat deflate.Blc reverse.blc | ./tromp > rev.Blc
|
||||
$ wc rev.Blc
|
||||
0 1 9 rev.Blc
|
||||
```
|
||||
and then try it out with:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ cat rev.Blc - | ./tromp
|
||||
Hello, world!
|
||||
^D
|
||||
@@ -384,7 +384,7 @@ and then try it out with:
|
||||
BLC8 program `symbolic.Blc` shows individual reduction steps on symbolic lambda terms.
|
||||
Here it is used to show the calculation of 2^3 in Church numerals:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo "(\f\x f (f (f x))) (\f\x f (f x))" > threetwo
|
||||
$ cat parse.Blc threetwo | ./tromp > threetwo.blc
|
||||
$ cat symbolic.Blc threetwo.blc | ./tromp
|
||||
@@ -412,7 +412,7 @@ Taking only the first line of output gives us a sort of BLC disassembler, an
|
||||
exact inverse of the above assembler. The prime number sieve disassembles as
|
||||
follows:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ cat symbolic.Blc primes.blc | ./tromp | head -1
|
||||
\a (\b b (b ((\c c c) (\c \d \e e (\f \g g) ((\f c c f ((\g g g) (\g f (g g)))) (\f \g \h \i i g (h (d f))))) (\c \d \e b (e c))))) (\b \c c (\d \e d) b)
|
||||
```
|
||||
@@ -421,7 +421,7 @@ Hardly any less obfuscated...
|
||||
|
||||
The last line of
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
cat symbolic.Blc primes.blc | ./tromp | head -16
|
||||
```
|
||||
|
||||
@@ -459,7 +459,7 @@ under the interpreter perform much worse than that same program written in Haske
|
||||
|
||||
Our interpreter copes well with extra levels of interpretation:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ time cat primes.blc | ./tromp -b | head -c 210 > /dev/null
|
||||
real 0m0.043s
|
||||
$ time cat uni.blc primes.blc | ./tromp -b | head -c 210 > /dev/null
|
||||
|
||||
+11
-11
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -25,38 +25,38 @@ For more detailed information see [2012 vik bugs](../../bugs.html#2012_vik).
|
||||
|
||||
To embed text (from file or command line):
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./vik e base.png filename > encodedimg.png
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./vik e base.png SomeRandomText > encodedimg.png
|
||||
```
|
||||
|
||||
To extract the embedded text:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./vik d encodedimg.png
|
||||
```
|
||||
|
||||
To embed a PNG into another:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./vik e base.png source.png > encodedimg.png
|
||||
```
|
||||
|
||||
To extract the embedded PNG:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./vik d encodedimg.png > restored.png
|
||||
```
|
||||
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
@@ -68,7 +68,7 @@ For those few who might use Windows this alternate code might work.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -116,7 +116,7 @@ possible to get the bitmap data from the extracted image, and run it through any
|
||||
of the previous winning brainfuck interpreters, but I thought it would be easier
|
||||
to include an interpreter in the program to avoid the hassle:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./vik e ioccc.png chocolate.png > encodedimg.png
|
||||
./vik b encodedimg.png
|
||||
```
|
||||
@@ -125,7 +125,7 @@ It is of course also possible to embed a
|
||||
[brainfuck](https://en.wikipedia.org/wiki/Brainfuck) program as a text file
|
||||
(as explained above) and decode it, e.g.:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./vik e ioccc.png .+[.+] > encodedimg.png
|
||||
./vik b encodedimg.png
|
||||
```
|
||||
@@ -154,7 +154,7 @@ compile the program on this platform, the following line can be added after
|
||||
the variable declarations in the main declaration in order to run
|
||||
correctly:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
_setmode(_fileno(stdout), 0x8000);
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -10,7 +10,7 @@ code](#alternate-code) below.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./zeitak < file
|
||||
```
|
||||
|
||||
@@ -21,7 +21,7 @@ text files that are not code.
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make test
|
||||
```
|
||||
|
||||
@@ -38,7 +38,7 @@ understand this extremely subtle entry.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
@@ -92,7 +92,7 @@ around it's position.
|
||||
* Ignores parenthesis inside strings or character constants, so no errors
|
||||
will be detected in the following line:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
printf(")");
|
||||
```
|
||||
|
||||
@@ -104,7 +104,7 @@ around it's position.
|
||||
* Escapes (e.g. `\"`) are ignored, so the following line will produce
|
||||
an error:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
printf("\"");
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user