388 Commits
Author SHA1 Message Date
Cody Boone Ferguson f3e7c04c27 Typo fixes in several bin/ files 2024-02-02 12:48:40 -08:00
Landon Curt Noll 657a0be130 add tool to sort .gitignore content
We sort with lines starting with # first.
We sort with lines starting with * second.
We sort with lines that do not start with [#!*] third.
We sort with lines starting with ! fourth.

Example usage in vim with a keyboard macro <escape>f:

```vim
:map ^[f 1G!G../../bin/sgi^M
```

 or via .vimrc:

```vimrc
" sort the entire .gitignore file using ../../bin/sgi
:map  ^[f 1G!G../../bin/sgi^M
```

 NOTE: The ^[ above is ((Escape)) and ^M is ((Control-M)).

Example usage in shell:

```sh
rm -f t && ../../bin/sgi < .gitignore > t && mv -f t .gitignore
```

Suggested usage:

```sh
bin/all-run.sh bin/sort.gitignore -v 1
```

Sorted all winner .gitignore according to this method.
Sorted all year level .gitignore according to this method.
Sorted top level .gitignore according to this method.
2024-02-01 14:35:49 -08:00
Cody Boone Ferguson dcd12a4d08 Typo fix in bin/all-run.sh 2024-01-27 11:55:46 -08:00
Cody Boone Ferguson 453007c299 Typo fixes in bin/gen-inventory.sh 2024-01-23 05:32:25 -08:00
Landon Curt Noll 909707c674 Merge pull request #2018 from xexyl/borsanyi2006-try
Add 2006/borsanyi/try.sh
2024-01-22 11:47:45 -08:00
Landon Curt Noll e70dbf35e0 add rationale to all shellcheck script disable points in pandoc-wrapper.sh 2024-01-22 10:26:19 -08:00
Landon Curt Noll c318f6150e add rationale to all shellcheck script disable points in readme2index.sh 2024-01-22 10:22:58 -08:00
Cody Boone Ferguson cf62d3ab94 Add ioccc-status.1, bug fix ioccc-status.sh
The man page is in /man/man1/. It is not clear to me if man/man1 should
be under another directory but that can be decided later and if
necessary it can be moved over. The man page has a few examples. More
could be contrived if necessary. It has no SEE ALSO section because it
is not clear to me what should be linked to (perhaps the IOCCC
website?). I felt like I should write this man page first, in
particular, because I wrote the script too and the benefit is I
discovered some bugs in the script as well that are now fixed.

The script only checked if the status.json file was readable but it did
not check if it is writable. It should check for both and it now does.
The exit code is the same as if the file does not exist, is not a
regular file or not readable: 1. It also now explicitly exits 0 at the
end of the script. The version was updated to

    IOCCC_STATUS_SCRIPT_VERSION="0.0.5-0 2024-01-22" # major.minor.release-patch YYYY-MM-DD

When fixing the script some things crossed my mind that might be worth
considering. First of all if dry-mode is specified (-N) does it really
need to have a status.json file arg specified? It might or might not.
Second should there be an option to create a new status.json file (if
the one does not exist)? These are perhaps worth considering and
wouldn't be hard to implement if these are desirable.
2024-01-22 06:01:36 -08:00
Cody Boone Ferguson 7fb2a3192e Improve number of arg ioccc-status error message 2024-01-22 04:38:01 -08:00
Cody Boone Ferguson 79a0486ec1 Fix arg check in ioccc-status.sh
It should be != 1 rather than -gt 1. Not having this meant that if no
arg was specified the usage message was not printed and instead the arg
of the status.json file (which was not given) was shown to not exist
(because it was empty so not a file).
2024-01-22 04:36:08 -08:00
Landon Curt Noll d9d2d2a127 move terms fron tmp to bin README.md 2024-01-21 21:46:53 -08:00
Landon Curt Noll d414b6d71f add quick-readme2index.sh, improve all-run.sh and readme2index.sh
Improved `all-run.sh` and `readme2index.sh` so that
certain command line options (e.g., -p, -P, -u, -U ...)
are only passed along to other tools if they are
given on the command line.

all-run.sh VERSION changed from "1.1.1 2024-01-19"
to "1.1.2 2024-01-20",

readme2index.sh VERSION changed from "1.1 2024-01-16"
to "1.1.1 2024-01-20".

Added `quick-readme2index.sh` that only calls
`readme2index.sh` if the `index.html` is not
a non-empty file, or of either `.winner.json`
and/or `README.md` is newer than `index.html`.

Updated all `index.html` files because the
the file contains a comment that includes
the newly modified readme2index.sh VERSION.
2024-01-21 00:21:40 -08:00
Landon Curt Noll 615b4ba4ad rename pandoc-wrapper.sh and all-run.sh
Using the - convention since that is what most
of the other bin tools use in their filenames.
2024-01-19 21:49:00 -08:00
Landon Curt Noll 3c06682b7f fix shellcheck comment line order 2024-01-19 14:43:49 -08:00
Landon Curt Noll 9c28fbb9ec document shellcheck disable with the wiki URL 2024-01-19 14:40:31 -08:00
Landon Curt Noll c1466f5165 build index.html for all winners
Updated manifest as per recent file changes.

Updated winner `.winner.json` to reflect the manifest changes.

Added [bin/all_run.sh](bin/all_run.sh) tool to run a command over
all winning entries.

These tools had slight improvements in the help usage message:

* bin/gen-author.sh VERSION="1.3.1 2024-01-16"
* bin/gen-inventory.sh VERSION="1.0.1 2024-01-16"
* bin/pandoc_wrapper.sh VERSION="1.3.1 2024-01-16"
* bin/subst.default.sh VERSION="1.1.1 2024-01-16"
* bin/subst.winner-index.sh VERSION="1.1.1 2024-01-16"

The `bin/readme2index.sh` tool was improved so that
if the `index.html` file exists and the tool forms
the exact same content, then the file `index.html`
file is NOT touched.

* bin/readme2index.sh VERSION="1.1 2024-01-16"

We used the following command to generate `index.html` files
for all winning entries:

```sh
bin/all_run.sh -v 3 bin/readme2index.sh
```

NOTE: We have not (yet) built HTML files above the winner directory
level (e.g., no year level nor top level HTML), nor have be built
non-index HTML files for winners.

NOTE: By default we are running `pandoc(1)` with:

```
--fail-if-warnings=true
```

This means that any problems with markdown to HTML
generates an error.  This is done to be sure that
the HTML conversion is clean.

We had to fix the following `README.md` files:

* `2000/rince/README.md`

The reference [^2] was never used.  We made a guess that [^2] applies
to the same spot as [^1].  Perhaps there is a better spot where
[^2] applies?

NOTE: For every reference, there MUST be some place where that
reference is used.

* 2012/vik/README.md

The string "$...$" is assumed to be a TeX encoded string.

NOTE: Every "$..$" needs to be backslashed as in "\$..\$".

* 2018/burton1/README.md

The reference [2] was duplicated.  We changed the
second [2] to [3].

NOTE: Every reference needs to have a unique number.

* 2020/carlini/README.md

The string "$...$" is assumed to be a TeX encoded string.

NOTE: Every "$..$" needs to be backslashed as in "\$..\$".

We also found 2 errors in the `author/author_handle.json` file set:

* author/Anonymous_2001.json

The `author/Anonymous_2001.json` file was missing.

* author/Jari_Arkko.json

The winner ID for `1989_jar.1` had a typo.
2024-01-17 00:32:39 -08:00
Cody Boone Ferguson c7fccaf9ee Move ioccc_status.sh to ioccc-status.sh in bin/ 2024-01-15 06:48:00 -08:00
Landon Curt Noll d19b5470ee adjust DOCROOT_URL_SLASH to just be /temp-test-ioccc/
Testing the value of using:

```sh
DOCROOT_URL_SLASH="/temp-test-ioccc/"
```

in case doing "../../" isn't liked by GitHub.
2024-01-15 00:14:48 -08:00
Landon Curt Noll bfc262732b adjust DOCROOT_URL_SLASH to just be /
Testing the value of using:

```sh
DOCROOT_URL_SLASH="/"
```

in case doing "../../" isn't liked by GitHub.
2024-01-14 23:59:10 -08:00
Landon Curt Noll c6e6201209 release readme2index.sh version 1.0 2024-01-14
The initial release of `bin/readme2index.sh` tool that converts
`READMD.md` and various JSON files such as `.winner.json`
as well as "author/author_handle.json" files.

Applied the `readme2index.sh` tool to generate `2020/ferguson1/index.html`.

We generated the  `2020/ferguson1/index.html` by executing:

```sh
./bin/readme2index.sh -v 3 2020/ferguson1
```

NOTE: This above tool requires **pandoc to be installed**.
See the [pandoc web site](https://pandoc.org) for how
to install.  We used _HomeBrew_ to install it,
but there is also a _macports_ process as well.

NOTE: While the above web page does have formatting issues, it is
a first attempt data driven programmatic web page generation.

Some adjustments can be made by mostly improving `ioccc.css`,
and some perhaps by modifying how `bin/pandoc_wrapper.sh`
invokes pandoc.  But probably most of the improvements can
be made by fixing and improving `ioccc.css`.

TODO: Fix and improve the `2020/ferguson1/index.html`
web page by fixing and improving `ioccc.css`.

Moved scripts and tools needed to generate HTML pages
into a new `/bin` subdirectory.

TODO: Consider getting rid of the [build-ioccc
repo](https://github.com/ioccc-src/build-ioccc) and just use the
`/bin` subdirectory.

NOTE: Some links in the `2020/ferguson1/index.html`
web page do not (yet) exist.

TODO: Once the basic format of the `2020/ferguson1/index.html` web
page is somewhat reasonable, generate `index.html` pages for other
winners.  Generate the year level `index.html' files.
Generate the top level HTML files, including the missing
`location.html` file.

Greatly simplified the `.winner.json` file format,
removing a number of fields that were not strictly needed
for generating an inventory on a `index.html` page.

Updated various versions:

* `bin/gen-author.sh` VERSION="1.3 2024-01-14"
* `bin/gen-inventory.sh` VERSION="1.0 2024-01-14"
* `bin/manifest.winner.json.awk` VERSION="1.0 2024-01-14"
* `bin/pandoc_wrapper.sh` VERSION="1.3 2024-01-14"
* `bin/readme2index.sh` VERSION="1.0 2024-01-14"
* `bin/subst.default.sh` VERSION="1.1 2024-01-14"
* `bin/subst.winner-index.sh` VERSION="1.1 2024-01-14"
* `tmp/gen_path_list.found.sh` VERSION="1.1 2024-01-14"
* `tmp/gen_winner_json.sh` VERSION="1.1 2024-01-14"

The `.winner.json` file format from winner_JSON_format_version
"0.5 2023-11-04" to "1.0 2024-01-14".

All `.winner.json` files have been updated to use the
new `.winner.json` file format.

The manifest (`tmp/manifest.numbers` and `tmp/manifest.csv`) has
updated to use the new `.winner.json` file format.

The following procedure was used to generate the
`tmp/manifest.csv` manifest file:

0. open [manifest.numbers](manifest.numbers) in numbers: modify if/as needed

NOTE: Please try to keep the [manifest.numbers](manifest.numbers) spreadsheet
      in order order.  Use Organize -> Sort -> ((Sort Now)) to sort.

NOTE: Empty fields in the [manifest.numbers](manifest.numbers) spreadsheet
      are not allowed.  By default, a cell that is empty is colored
      as a warning.

1. File -> Export To -> CSV...
    * 1a. `[ ]` Include table names (unset)
    * 1b. Text Encoding: Unicode (UTF-8)
    * 1c. Click ((Save..))

2. Save As: manifest.csv
    * 2a. Select the `tmp` directory

3. Click ((Export))
    * 3a. If needed click ((Replace))

4. Execute ./tmp/[fix_csv.sh](fix_csv.sh)

NOTE: You must run the [fix_csv.sh](fix_csv.sh) in the above
      step in order to make the CSV file usable by other tools.

NOTE: If no changes are needed in the above step, the
      original file content will be restored.

5. Execute ./tmp/[gen_path_list.found.sh](gen_path_list.found.sh)

NOTE: The above step silently performs a `make clobber` at the
      top level, and so it takes a bit of time.

NOTE: If no changes are needed in the above step, the
      original file content will be restored.

6. Execute ./tmp/[check_path_list.sh](check_path_list.sh)

NOTE: The above step prints nothing and for an exit 0, then
      all is well.  If there is a problem, such as files
      found that are not part of the manifest, or files
      in the manifest that are not found, then an error
      message will be printed and the tool will exit non-zero.
      If errors are reported, go back to step 0 and
      correct the errors.

7. Execute ./tmp/[run_all.sh](run_all.sh) ./gen_winner_json.sh

NOTE: The above step will take a few seconds to run.  It will rebuild
      all `.winner.json` files for all winners.

NOTE: If no changes are needed in the above step, the
      original file content will be restored.

8. Execute `git status` and inspect changes

NOTE: Check in changes if and as needed.

NOTE: In a number of shell scripts under `bin/*.sh`,
      and in the `bin/manifest.winner.json.awk` script
      you will find comments of the form:

```
```

This is a note that when tools such as `jnamval` (and `jval` and `jfmt`) are
ready, these gross hacks should be replaced with calls to those tools.
Until they are ready, some must be careful with the layout of JSON files.

A number of bugs and typos have been fixed.

NOTE: Fixing typos in the files touched by this comment is welcome.
      This includes scripts, data files, text files, etc.

The _inventory_order_, _display_as_, _display_via_github_.  and
_winners_text_ fields of the [manifest.numbers](manifest.numbers)
spreadsheet were just set to have some initial values.
As they impact the inventory displayed on `index.html` pages,
their content needs to be improved.

NOTE: Improving the above mentioned fields of the
      [manifest.numbers](manifest.numbers) spreadsheet is welcome.
2024-01-14 22:03:28 -08:00
Landon Curt Noll 828ddef5eb setup src tree, clean out bin directory
The src tree now contains source for tools that will be published
as part of the IOCCC winner web site.  However, the compiled and/or
installed tools that install under bin, will NOT be published.
The bin directory is now excluded under .gitignore so that
those who use this repo will have to do:

```sh
cd src; make clobber all install
```

The src/Makefile in turn drives rules in sub-directory
Makefiles.  Currently there are only two sub-directories:

winner_name - a completely re-written extract_winner_handles.sh
sgit - run sed on all files under git control

The check_awards.sh tool was moved under tmp
as this tool depends on CSV file, will not be needed soon,
and will go away when the tmp directory is cleaned
out towards the end of finishing issue #4.
2023-06-15 18:40:38 -07:00
Cody Boone Ferguson 9419f96028 Add script to extract winner handles
This is the first step in making the new CSV file that identifies which
entries each author won. To get a list of all winning handles run

    bin/extract_winner_handles.sh

...which is a very simple pipeline (that could probably be simplified
further) acting on winners.html.
2023-05-15 05:45:46 -07:00
Cody Boone Ferguson fdc12eb518 Add comments to bin/check_awards.sh explaining it
... and how it was generated ...
2023-05-14 02:39:07 -07:00
Cody Boone Ferguson c0ac7471d2 Actually do chmod +x bin/check_awards.sh 2023-05-13 12:28:12 -07:00
Cody Boone Ferguson d235b565df Fix consistency of award titles
This was done quite easily with a bit of thought. I generated a script
that could be modified in vim if necessary (as it turned out to be
though some of it could have been generated too but I did not think of
everything at once and it is a hack).

This is how I generated it:

    echo '#!/bin/bash' > bin/check_awards.sh ; ( while read -r g ; do echo grep "$g"; done < <(sed -e 's,_,/,g' -e 's/"/\\"/g' tmp/year-auth-prize.csv | awk -F, '{print grep "\x22" $2 "\x22" " " $1 "/" "README.md"}' ); ) >> bin/check_awards.sh

Then I I modified the file (again this was a hack to make it easier and
quicker and better for being tired too) in vim to make the grep use -Hc
so I could pipe it to 'grep :0'. This found the files without the right
award. So the final command was:

    sh bin/check_awards.sh |grep :0

though I did have to edit some files several times.

For reference the script has been added to the repo too but with +x
permissions.

This change also required updating the CSV file in tmp/.
2023-05-13 07:02:07 -07:00
Cody Boone Ferguson baf357a23f New version of sgit
Now supports backup extension.

Some warnings are noted in the usage (about backup extensions - one of
which goes for sed in general) and the README.md file.

Typo fixed the README.md file (some examples were in error for instance)
as well and add additional examples.

The new version corresponds to
https://github.com/xexyl/sgit/commit/9fccaa8cd680d3ed7cd91516710a5672630b5dff;
the README.md file had several new commits.
2023-04-19 03:15:29 -07:00
Cody Boone Ferguson 05da826f01 Update sgit + add sgit.README.md
Add warning about use of -o n without -I depending on the sed command.

Updated version.

The README.md I'm not sure about but it feels like it might belong there
anyway. It can be removed if it does not seem useful or it is out of
context (and it might very well be). Nevertheless I think it's important
that the warning be there so it's good to update sgit here as well.
2023-04-12 06:00:07 -07:00
Cody Boone Ferguson 378e4d61fb Bug fix sgit
It did not iterate over all globs because the condition of the loop was

    while [[ "$i" -le "$#" ]]; do

but in the loop i was incremented but the num args left was decremented
thus they went in opposite orders. Instead record how many globs are
there first and check i against that.
2023-03-17 10:04:12 -07:00
Cody Boone Ferguson 01e76d013d Remove no longer true comment in big/sgit
Spaces haven't been a problem for some time but I neglected to copy the
script to the bin/ directory here.
2023-03-03 04:45:08 -08:00
Landon Curt Noll 546498a516 Merge branch 'master' into updates-post-birthday 2023-02-22 20:44:14 -08:00
Cody Boone Ferguson a41636a0ed Comment fixes in sgit 2023-02-16 12:10:23 -08:00
Cody Boone Ferguson 05e83b60ff Bug fix sgit - new version 0.0.5-1 16-02-2023
A problem existed where more than one command would not work (always or
in some conditions depending on the command: not sure which). This
prevented a fix in years.html which will be in the next commit. The sgit
repo has been updated with this fix as well.

The fix is to remove space from IFS and to change "${SED_COMMANDS[*]}"
to be "${SED_COMMANDS[@]}".
2023-02-16 04:38:40 -08:00
Cody Boone Ferguson af32e18f77 New version of sgit - many improvements
Now allows to not overwrite files.

Now allows sed options to be passed to sed.

Allows specifying path to sed.

This script now has its own repo at https://github.com/xexyl/sgit. I
don't expect many people to use it but it seemed like it was worthy of a
repo as it is a pretty handy script (though far from perfect).
2023-02-15 09:08:40 -08:00
Cody Boone Ferguson 1464a25e5a Fix spaces in sed commands in sgit
New version of sgit.

Script now allows for spaces in sed commands. Thus one can do something
like:

    sgit -v3 -x -e 's/web site/website/g'  .

to set verbosity to level 3, turn on tracing (see below) and change
occurrences of 'web site' to be 'website'.

Also added -x option to turn on tracing.
2023-02-15 06:21:10 -08:00
Cody Boone Ferguson a1494028d7 Add a limitation note in sgit
Namely that if the sed command has spaces it will be a problem. Whether
this will be fixed is yet to be seen.
2023-02-13 09:53:39 -08:00
Cody Boone Ferguson c8d9d2eeb9 Minor fix to sgit
Accidentally committed absolute path of sed.

Also it now shows the sed commands with high enough -v level. This is to
help with a strange problem I discovered (not fixed yet).
2023-02-13 08:40:11 -08:00
Cody Boone Ferguson ebd01ebf8d Greatly improve my sgit script
Script no longer requires GNU sed but works with other sed
implementations as well (only other one tested is macOS however).

Uses getopts to parse options. Usage is now:

    usage: sgit [-h] [-V] [-v level] [-e command] <glob...>

	-h                      print help and exit
	-V                      print version and exit
	-v level                set verbosity level
	-e command              append sed command to execute on globs

which means that yes one can specify more than one glob. As long as one
sed command is specified (chose -e to match sed) and one arg is
specified after the last option then the command line is okay (whether
the sed command or file is okay is another matter entirely).

Verbose output to help test / debug features or if just interested in
what's being done.
2023-02-13 06:16:53 -08:00
Landon Curt Noll aa263427e3 added bin directory for misc tools
Added `bin/sgit`.

This directory is NOT intended to become a huge software project
right now.  For now it is just a convenient place to store tools.
Please avoid overthinking, over documenting tools under bin.

Later on there will be a tool that builds links in the web site
from JSON files, perhaps forms HTML files from markdown files, etc.
However we will have to make major progress on issue #1, issue #2,
issue #3 and issue #4 before such code can be written.

In some cases tools put under bin might go away later on
if they are no longer needed.
2023-02-12 17:59:51 -08:00