The downloads index was previously generated with QuickHash GUI. I decided to cobble something together in Bash that better suited my needs:
$ gfind . -name "[!.]*" -type f -printf '%f %s ' -exec shasum -a 256 {} \; | awk -F ' ' '{ print $1, "| " $2, "| " $3 }' | sort -f | sed 's/_/\\_/g' | (printf "Filename | Bytes| SHA-256\n--- | --- | ---\n" && cat) | markdown2.py --extras tables > output.html
gfind . -name "[!.]*" -type f
Find non-hidden files,
-printf '%f %s '
print their filenames and sizes,
-exec shasum -a 256 {} \;
and generate SHA-256 hashes for them.
awk '{ print $1, "| " $2, "| " $3 }'
Print the first 3 fields from gfind's output, separating them with vertical bars (necessary for the markdown table).
sort -f
Sort the resultant list alphabetically, ignoring case.
sed 's/_/\\_/g'
Find underscores and prepend backslashes to them so that they are not interpreted as italics when converting markdown to HTML.
(printf "Filename | Bytes| SHA-256\n--- | --- | ---\n" && cat)
Prepend header row (with the minimum number of dashes and vertical bars for the markdown table) to output.
markdown2.py --extras tables
Convert the markdown table to HTML
> table.html
and save as "output.html" in the current directory.
gfind was required as the version of find included with macOS 10.14 does not support printf. Installed via brew install findutils.
Step 6 uses Claudius' neat hack for prepending something to stdout of previous command.
markdown2 is "a fast and complete Python implementation of Markdown" which "also comes with a number of extensions (called 'extras') for things like syntax coloring, tables, header-ids."
Switched to using an unordered list: gfind . -name "[!.]*" -type f -printf '%f %s ' -exec shasum -a 256 {} \; | sort -f | sed 's/_/\\_/g' | awk '{ printf "- %s\n - bytes: <tt>%s</tt>\n - SHA-256: <tt>%s</tt>\n", $1, $2, $3 }' | markdown2.py > output.html
/nix | Mar 24, 2019