Code

Small tools that each solve one complete problem. Every one says what it does, what it doesn’t, where its source is, how it was tested, and how to check you got the real file. License: MIT.

  1. CODE 01File fingerprint · runs in this page
  2. CODE 02Redirect and link tracer · Node
  3. CODE 03Portable diagnostic record · JSON Schema

CODE 01 · VERSION 1.0.0File fingerprint

Pick a file and get its SHA-256 fingerprint. Two files with the same fingerprint are the same bytes. Use it to check a download, to prove a file didn’t change, or to compare the copy you have with the copy someone else has.


What it does
Computes SHA-256 of the file’s exact bytes in your browser, using the browser’s built-in cryptography.
What it doesn’t
Upload anything, scan for viruses, or tell you whether a file is safe. A matching fingerprint proves sameness, not goodness.
Source
The script at the bottom of this page. View source, it is a few lines long.
Tests
Checked against the standard test value: the three letters abc must give ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad.
How to use
Choose the file, then compare the fingerprint with the one the sender published. Every character must match.

CODE 02 · VERSION 1.0.0Redirect and link tracer

A link that “just doesn’t work” is usually a chain of redirects with a broken link in it. This follows the chain one hop at a time and shows you every hop, so you can see exactly where it goes wrong.

node redirect-trace.mjs https://example.com/old-page
node redirect-trace.mjs --list links.txt
What it does
Follows redirects by hand and prints each status and destination. Flags loops, more than ten hops, https to http downgrades, redirects with no destination, and chains that end in an error. With --list it checks a whole file of links.
What it doesn’t
Run JavaScript, log in, submit forms, follow page-level refreshes, or judge what is on the page. It reports what the server says.
Source
redirect-trace.mjs
Needs
Node 18 or newer. No dependencies, nothing to install.
Tests
Eight cases against a local server: clean page, two-hop chain with a relative destination, loop, dead end, missing destination, unreachable host, downgrade, hop limit.
Checksum
SHA-256 88410a249fd10b913cd1680d8737830388374722eced92a3fabfdf01b6f2f8ea

CODE 03 · VERSION 1.0.0Portable diagnostic record

The shape of a GROK’it diagnostic as plain JSON, so the work can leave GROK’it and still make sense: reference, problem, facts, sources, tests, unknowns, road, act, receipt. Use it for your own records too. You never need GROK’it to read one.

What it does
Defines the fields and which ones are required, with a worked example marked SYNTHETIC.
What it doesn’t
Store anything, or carry private content on its own. It is a shape, not a database.
Source
grokit-record.schema.json
Tests
The schema parses, and its example carries every required field in the required form.
Checksum
SHA-256 5f5049a65e0ca9b88e19ced927c72252bdb8a54550b7ea74ce370122fdccb0e6

LICENSEMIT

Use, copy, change and share these tools freely, including commercially. Keep this notice with them. They come as they are, with no warranty, and the authors are not liable for what you do with them.

Stuck on something like this? Tell GROK’it what’s happening →