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
+24
-24
@@ -1,6 +1,6 @@
|
||||
## To build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make
|
||||
```
|
||||
|
||||
@@ -11,7 +11,7 @@ at once. See [Alternate code](#alternate-code) below.
|
||||
|
||||
## To use:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog
|
||||
|
||||
# get recode help:
|
||||
@@ -49,13 +49,13 @@ are allowed.
|
||||
|
||||
## Try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.sh
|
||||
```
|
||||
|
||||
What does:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
echo | ./recode
|
||||
echo | ./recode -v
|
||||
```
|
||||
@@ -72,14 +72,14 @@ and to make it a bit more like the real thing.
|
||||
|
||||
### Alternate build:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make alt
|
||||
```
|
||||
|
||||
The default time to sleep is 400000 microseconds but you can change this by
|
||||
doing:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
make clobber SLEEP=600000 alt
|
||||
```
|
||||
|
||||
@@ -93,7 +93,7 @@ Use `prog.alt` as you would `prog` above.
|
||||
|
||||
### Alternate try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./try.alt.sh
|
||||
```
|
||||
|
||||
@@ -110,7 +110,7 @@ There is a good deal of useful documentation that is provided with this entry:
|
||||
* [enigma.1](enigma.1) - A useful man page for this entry. To render, try:
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
man ./enigma.1
|
||||
```
|
||||
|
||||
@@ -251,7 +251,7 @@ the result (after finishing the enciphering).
|
||||
|
||||
If you run it like:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./prog -
|
||||
```
|
||||
|
||||
@@ -283,7 +283,7 @@ program as well as how to use the two winning entries of the [Morse
|
||||
code](https://en.wikipedia.org/wiki/Morse_code) that I referred to earlier:
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./prog -
|
||||
Ring 1: 3
|
||||
Setting 1: I
|
||||
@@ -317,7 +317,7 @@ default settings; as the judges suggest this invocation I will not show it here.
|
||||
|
||||
But you can also type it out like this:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./prog
|
||||
IOCCC
|
||||
UUMMX
|
||||
@@ -328,7 +328,7 @@ The IOCCC comes from stdin; the `UUMMX` is written to stdout.
|
||||
If I compile the 2014 entry and copy it to my local directory as
|
||||
`vik` I might do:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo TEST|./prog |./vik | mplayer -demuxer rawaudio -
|
||||
```
|
||||
|
||||
@@ -340,7 +340,7 @@ a bug in that entry (Fedora, CentOS and macOS all affected).
|
||||
For example I can use the syntax provided in the winning remarks along with my
|
||||
entry to write it to a file. Say:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo TEST|./prog |./vik > test.raw
|
||||
$ ./vik e < test.raw | ./prog
|
||||
LEST
|
||||
@@ -348,21 +348,21 @@ entry to write it to a file. Say:
|
||||
|
||||
Why did that happen? This shows more details:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./vik e < test.raw
|
||||
SCWV
|
||||
```
|
||||
|
||||
However as can be seen the first char is wrong:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo TEST|./prog
|
||||
KCWV
|
||||
```
|
||||
|
||||
And piping the original output to my entry itself you get the original input:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo TEST | ./prog | ./prog
|
||||
TEST
|
||||
```
|
||||
@@ -372,7 +372,7 @@ idea anyway. Neither do I know if the original transcoding is correct.
|
||||
|
||||
What if I use the input string `LEST` instead? In that case it worked fine:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo LEST | ./prog | ./vik > lest.raw
|
||||
$ ./vik e < lest.raw | ./prog
|
||||
LEST
|
||||
@@ -380,7 +380,7 @@ What if I use the input string `LEST` instead? In that case it worked fine:
|
||||
|
||||
But there's one obvious question, right? Let's try the most important one:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo IOCCC | ./prog | ./vik > ioccc.raw
|
||||
$ ./vik e < ioccc.raw
|
||||
UUMMX
|
||||
@@ -396,7 +396,7 @@ too. Notice also how it showed the same output that my program gave it - `UUMMX`
|
||||
|
||||
What about the other [Morse code entry](../../1998/dorssel/dorssel.c)?
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo IOCCC | ./prog | ./dorssel
|
||||
..- ..- -- -- -..-
|
||||
```
|
||||
@@ -441,7 +441,7 @@ The parser is in a sense rather rudimentary but allows for both interactive and
|
||||
automatic (e.g. via the [recode](recode.c) program) input. This does mean that
|
||||
something like the following can happen:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./prog -
|
||||
Ring 1: 1AB
|
||||
Setting 1: Position 1: Ring 2: 2CD
|
||||
@@ -504,7 +504,7 @@ should help you remember (though not at this time in our world it might help you
|
||||
later on?). This might become even more useful after the challenge is accepted,
|
||||
accomplished and made use of! :)
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo ABC | ./prog
|
||||
GYM
|
||||
$ echo ABC | ./prog | ./prog
|
||||
@@ -536,7 +536,7 @@ ended his life. (I later made a bug fix but I consider this inconsequential).
|
||||
|
||||
As for [recode.c][] though I really love this:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
/\
|
||||
/ This is *not* what you think:
|
||||
```
|
||||
@@ -552,13 +552,13 @@ It's an [Enigma machine](https://en.wikipedia.org/wiki/Enigma_machine) simulator
|
||||
that proof that it's obfuscated itself?! :) Silliness aside [obfuscation.txt][]
|
||||
has some of the ways I think this entry is obfuscated. To decipher try:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./recode -Robfuscation.key -fobfuscation.txt | ./prog - 2>/dev/null > obfuscation.md
|
||||
```
|
||||
|
||||
To encipher:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./recode -Robfuscation.key -fobfuscation.md | ./prog - 2>/dev/null > obfuscation.txt
|
||||
```
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ there is an aesthetic appeal to my eyes too).
|
||||
Y<:19:><:27:> but it's not the only example. Here the compound literal of 13
|
||||
ints:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
int *z=(int[13]) { 0 } , *e, *g;
|
||||
```
|
||||
|
||||
Then in main:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
e = z + 10;
|
||||
g = e + 1;
|
||||
|
||||
@@ -39,14 +39,14 @@ ints:
|
||||
more confusing still. There are at least two other ways that are much easier
|
||||
to read that could accomplish the same thing. It continues on:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
/* ... */
|
||||
e<:i-3:> = (j < 1 ? 1 : (j > 5 ? 5 : j))-1;
|
||||
```
|
||||
|
||||
* Observe these two functions:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
void w(char *s, int k, int v)
|
||||
{
|
||||
for(e<:2:> = 0; s<:*P:>; ++e<:2:>)
|
||||
@@ -96,7 +96,7 @@ temporary variable instead of a regular int in the function (so make it global);
|
||||
and (2) I didn't want to risk changing all the offsets: thus I just made that
|
||||
address `e[1]`. Thus I also have:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
for (*g = 0 ; *g < 10; ++*g)
|
||||
{
|
||||
r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>;
|
||||
@@ -117,7 +117,7 @@ address `e[1]`. Thus I also have:
|
||||
* The above function Z() takes a `char x` but you won't notice it being used
|
||||
at all. Why? In fact I call it like so:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
k = Z(r<:-1:>=k);
|
||||
```
|
||||
|
||||
@@ -132,7 +132,7 @@ at all. Why? In fact I call it like so:
|
||||
refer to the same variable in more than one way (or in some cases maybe more
|
||||
correct to say 'same location'). In the Z() function for example:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
r<:-2:> = Y<:14:><:*(e+1):>; r<:-3:> = Y<:15:><:1<:e:>:>;
|
||||
```
|
||||
|
||||
@@ -153,7 +153,7 @@ index (sort of).
|
||||
* Another set of char arrays in one: the five rotors as well as the two
|
||||
reflectors in one `char [][27]`. This makes for some fun code like:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
(Y<:e<:-10:>+5:><:k-'A':>) && (k = Y<:e<:-10:>+5:><:k-'A':>);
|
||||
```
|
||||
|
||||
@@ -194,7 +194,7 @@ enough because as they rightly point out they can just use the C preprocessor
|
||||
itself. But although I have quite a few cpp directives I am not using them for
|
||||
obfuscation but rather to save bytes. For examples:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
%:define J(x) do(*x)=getchar(); while((*x)=='\n')
|
||||
```
|
||||
|
||||
@@ -205,7 +205,7 @@ obfuscation but rather to save bytes. For examples:
|
||||
particular I want to bring up though because I think it's a curious one and
|
||||
it ties in to another point above:
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
%:define A(y) *(&Y<:7:><:1:>+(y))
|
||||
```
|
||||
|
||||
@@ -213,7 +213,7 @@ obfuscation but rather to save bytes. For examples:
|
||||
to the notch settings (I think it was the notch settings anyway). Now I
|
||||
could have done say
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
char a = Y[7][1], b = Y[7][3], c = Y[7][5];
|
||||
```
|
||||
|
||||
@@ -248,7 +248,7 @@ variables in recode.c, move them to prog.c, compile and expect it to work right.
|
||||
|
||||
* Also what is this about ?
|
||||
|
||||
```<!---c-->
|
||||
``` <!---c-->
|
||||
/\
|
||||
/ This is *not* what you think:
|
||||
void D(char*x){ /* ... */ }
|
||||
|
||||
+21
-21
@@ -55,7 +55,7 @@ wonderful 'challenge' for everyone.
|
||||
|
||||
# <a name="options" href="#toc">Options</a>
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./recode -h
|
||||
usage: ./recode [options]
|
||||
-v display selected settings
|
||||
@@ -71,7 +71,7 @@ if you don't give the option to read in a file for input.
|
||||
|
||||
`-v` shows selected settings. For example combining `-r` and `-v`:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo IOCCC | ./recode -r -v
|
||||
Ring 1: ( I) EKMFLGDQVZNTOWYHXUSPAIBRCJ
|
||||
Ring 2: ( V) VZBRGITYUPSDNHLXAWMJQOFECK
|
||||
@@ -104,7 +104,7 @@ encipherment/decipherment). If the file cannot be opened it sets back to stdin.
|
||||
or is the same file name (see below) then only stdout will be used. Example of
|
||||
randomised output going to a file:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./recode -r -oconfig
|
||||
IOCCC
|
||||
3PP4UB5GG1ELGTKFCOPVBNUYXJAWSDIOCCC
|
||||
@@ -143,7 +143,7 @@ what about if one exists but the other does not?
|
||||
Due to the way the parsing of options is done (no spaces between option char and
|
||||
argument) shell expansion will not work right so for example doing:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./recode -R~/config
|
||||
```
|
||||
|
||||
@@ -163,7 +163,7 @@ the program interactively.
|
||||
If stdin is not a tty (`!isatty(0)`) and neither randomised mode nor reading in
|
||||
from a file is specified then you might just see something like:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo testing test tests | ./recode
|
||||
1AB2BB3CC1testing test tests
|
||||
|
||||
@@ -189,7 +189,7 @@ input manually (if you randomise or read in from previously saved file no input
|
||||
need be done at all) then make sure to redirect stderr to /dev/null. If you
|
||||
don't you might see something like:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./recode -r | ./prog -
|
||||
Ring 1: IOCCC
|
||||
Setting 1: Position 1: Ring 2: Setting 2: Position 2: Ring 3: Setting 3: Position 3: Reflector: Plugboard pair 1: Plugboard pair 2: Plugboard pair 3: Plugboard pair 4: Plugboard pair 5: Plugboard pair 6: Plugboard pair 7: Plugboard pair 8: Plugboard pair 9: Plugboard pair 10: DEVIY
|
||||
@@ -205,7 +205,7 @@ That's why after I sent EOF it printed out the remaining strings to stderr.
|
||||
|
||||
# <a name="manuallytest" href="#toc">Manually test the recode program with the Enigma program</a>
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ cat input
|
||||
IOCCC
|
||||
|
||||
@@ -249,7 +249,7 @@ than the simulator: because with the size restrictions on my entry I saved bytes
|
||||
by using the same loop where I could. It just felt more natural to have them
|
||||
grouped together in a configurator for the [simulator](prog.c).
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC | ./prog - 2>/dev/null
|
||||
HQNVO
|
||||
$ echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRIOCCC | ./prog - 2>/dev/null | echo 1AA2AA3AA2ABCD..EFGHIJKLMNOPQRHQNVO | ./prog - 2>/dev/null
|
||||
@@ -273,21 +273,21 @@ What happens if the plugboard pairs are the same but in a different order? It's
|
||||
the same output:
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo 1AA2AA3AA2AB..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
|
||||
HQNVO
|
||||
```
|
||||
|
||||
Also if you flip the order of the letters in the pair e.g. the AB as BA instead:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo 1AA2AA3AA2BA..CDEFGHIJKLMNOPQRIOCCC|./prog - 2>/dev/null
|
||||
HQNVO
|
||||
```
|
||||
|
||||
# <a name="onlyconfig" href="#toc">Only write config file</a>
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./recode -v -oconfig -finput >/dev/null
|
||||
Rotors:
|
||||
(1) I: EKMFLGDQVZNTOWYHXUSPAIBRCJ
|
||||
@@ -345,7 +345,7 @@ pair. This is because it consumes input overflow.
|
||||
It shouldn't be this way for the simulator though because that could cause
|
||||
inconsistent number of characters expected before the text to encipher.
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ cat config
|
||||
1AB2CD3EF2ABCDEFGHIJKLMNOPQRST
|
||||
|
||||
@@ -363,7 +363,7 @@ directly type ctrl-d (or whatever you have EOF set to) or give it an empty file.
|
||||
The following are all equivalent in that they will write to a settings file (the
|
||||
first one will print a newline with the echo but that won't matter):
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo | ./recode -r -osettings
|
||||
$ echo -n | ./recode -r -osettings
|
||||
$ > empty
|
||||
@@ -380,7 +380,7 @@ set another variable to indicate if it should be printed.)
|
||||
|
||||
# <a name="reuseconfig" href="#toc">Reusing a configuration</a>
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo -n|./recode -r -oconfig
|
||||
4UH5II1RJ1SPIFEJLYGZWRTBHVCAMN$
|
||||
|
||||
@@ -405,7 +405,7 @@ set another variable to indicate if it should be printed.)
|
||||
|
||||
Alternatively you can just use the `-R` and `-f` options:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./recode -finput.txt -Rconfig | ./prog - 2>/dev/null > output2
|
||||
$ diff output output2
|
||||
$
|
||||
@@ -456,7 +456,7 @@ participants of the IOCCC do). Other things there don't mean anything but what
|
||||
does is the output:
|
||||
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ cat output
|
||||
DBFAF 2020 Ittejg ltblwriac uqdfqvr dhqh ghhf
|
||||
|
||||
@@ -477,7 +477,7 @@ does is the output:
|
||||
|
||||
This is like the above only randomised:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ ./recode -r -oconfig|./prog - 2>/dev/null
|
||||
IOCCC
|
||||
UGEVP
|
||||
@@ -489,14 +489,14 @@ the config file (for deciphering later) and then all of it was piped to the
|
||||
Enigma entry resulting in the line below IOCCC. But let's verify it worked out
|
||||
okay:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ cat config
|
||||
2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ
|
||||
```
|
||||
|
||||
Without having to copy/paste intermediate results:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo IOCCC | ./recode -Rconfig | ./prog - 2>/dev/null | ./recode -Rconfig | ./prog - 2>/dev/null
|
||||
IOCCC
|
||||
```
|
||||
@@ -504,7 +504,7 @@ Without having to copy/paste intermediate results:
|
||||
You can also use a string for the `-R` option. I'll use command substitution and
|
||||
actual pasting to demonstrate:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
$ echo IOCCC | ./recode -R$(cat config) | ./prog - 2>/dev/null | ./recode -R2BM4GJ3HK1LNCBXWRMGKSYIAZUTPVJ | ./prog - 2>/dev/null
|
||||
IOCCC
|
||||
```
|
||||
@@ -612,7 +612,7 @@ the key you wish to select is
|
||||
|
||||
you can do:
|
||||
|
||||
```<!---sh-->
|
||||
``` <!---sh-->
|
||||
./recode -R0EZ4PC1CC0PGTAQSOXWNMDRYKFUZEI -fencrypted.html | ./prog - 2>/dev/null > decrypted.html
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user