tinyapps.org / blog

Random harvest #

/misc | Mar 26, 2019

Generate an HTML table of files with their sizes and SHA-256 hashes #

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
  1. gfind . -name "[!.]*" -type f
    Find non-hidden files,

  2. -printf '%f %s '
    print their filenames and sizes,

  3. -exec shasum -a 256 {} \;
    and generate SHA-256 hashes for them.

  4. awk '{ print $1, "| " $2, "| " $3 }'
    Print the first 3 fields from find's output, separating them with vertical bars (necessary for the markdown table).

  5. sort -f
    Sort the resultant list alphabetically, ignoring case.

  6. sed 's/_/\\_/g'
    Find underscores and prepend backslashes to them so that they are not interpreted as italics when converting markdown to HTML.

  7. (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.

  8. markdown2.py --extras tables
    Convert the markdown table to HTML

  9. > table.html
    and save as "output.html" in the current directory.


/nix | Mar 24, 2019

Changes #

After 12 years at the same IP address with Slicehost/Rackspace VPS hosting, it's time to move on; a long-standing lack of hard billing limits (and the attendant unlimited exposure) coupled with the clear change in course finally forced the move.

The site has been migrated to Netlify, with the exception of the downloads directory, which is now hosted at Neocities. The list of SHA-256 hashes, however, remain at Netlify (a forthcoming post will cover how the list is generated).

Thanks to Netlify's redirect & rewrite rules, the move should be fairly seamless, but please let me know if you find any broken links or other anomalies (the fault of which are entirely my own).

/misc | Mar 23, 2019

Quickly scan a Windows host for known vulnerabilities #

with Windows Exploit Suggester - Next Generation (WES-NG):
WES-NG is a tool which based on the output of Windows' systeminfo utility provides you with the list of vulnerabilities the OS is vulnerable to, including any exploits for these vulnerabilities. Every Windows OS between Windows XP and Windows 10, including their Windows Server counterparts, is supported.
  1. wes.py --update
  2. systeminfo.exe > systeminfo.txt
  3. wes.py systeminfo.txt

/windows | Mar 03, 2019

Creating HTML or PDF contact sheets in macOS #

Automator's "New PDF Contact Sheet" action hung on a simple job, but it led to finding MakePDF.app hiding in "/System/Library/Image Capture/Automatic Tasks/" along with "Build Web Page.app":

/mac | Feb 20, 2019

Replace or recover domain cached credentials #

posted to the docs section.

/windows | Jan 29, 2019

Alternatives to dark mode extensions in Safari #

Unlike Content Blocker extensions like Wipr, dark mode extensions for Safari require extensive permissions (e.g., "Can read sensitive information from webpages, including passwords, phone numbers, and credit cards on all webpages" and "Can see when you visit all webpages").

Safer alternatives include:

/mac | Jan 24, 2019

Clone "Date modified" values without recopying files #

Problem: C:\A\ and C:\B\ contain the same files and folders, but the timestamps in C:\B\ are incorrect.

Solution: Mirror the file and folder timestamp values from C:\A\ to the same files and folders in C:\B\ (without having to recopy the files) via robocopy:

C:\>robocopy C:\A\ C:\B\ /E /DCOPY:T /COPY:T
               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         3         0         3         0         0         0
   Files :        14        14         0         0         0         0
   Bytes :   3.339 g   3.339 g         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00

   Speed :           239063077333 Bytes/sec.

robocopy's log is incorrect; no directories were skipped (all their timestamps were updated), no files were copied (only their timestamp data was), and the hardware wasn't quite up to 239GB/sec.

/windows | Jan 16, 2019

tree: hide control characters and display Japanese properly #

After installing tree in macOS (brew install tree), running it did not produce the expected results:

$ tree
└── 宮?\216駿
    ├── 1\ 風?\201?谷?\201??\203\212?\202??\202??\202?.iso
    ├── 2\ 天空?\201??\237\216?\203??\203\222?\202\232?\203??\202?.iso

Specifying the character set sadly did not avail, and saving results to a file seemingly exacerbated the problem:

$ tree --charset utf-8 -o list.txt

Partial view of file as it appeared it Sublime Text:

├── list.txt
└── <0x1b>[01;34må®®å´\216駿<0x1b>[00m

The solution was to use the -N ("Print non-printable characters as is") and -n ("Turn colorization off always", which hides the color control characters / ANSI escape codes) options:

$ tree -Nn
└── 宮崎駿
    ├── 1 風の谷のナウシカ.iso
    ├── 2 天空の城ラピュタ.iso
    ├── 3 となりのトトロ.iso
    ├── 4 魔女の宅急便.iso
    ├── 5 もののけ姫.iso
    └── 6 千と千尋の神隠し.iso

1 directory, 6 files

/mac | Jan 15, 2019

FastCopy: exclude directories and delete files unique to destination #

/windows | Jan 15, 2019

Subscribe or visit the archives