Skip to content

Instantly share code, notes, and snippets.

View notriddle's full-sized avatar

Michael Howell notriddle

View GitHub Profile
@notriddle
notriddle / lintcheck_crates_io_logs.txt
Created April 29, 2025 22:53
lintcheck run for `doc_suspicious_footnotes` with digits-only check removed
This file has been truncated, but you can view the full file.
clippy 0.1.88 (9f74df2b61 2025-04-29)
### Reports
target/lintcheck/sources/anyhow-1.0.86/src/backtrace.rs:27:27 clippy::incompatible_msrv "current MSRV (Minimum Supported Rust Version) is `1.39.0` but this item is stable since `1.65.0`"
target/lintcheck/sources/anyhow-1.0.86/src/backtrace.rs:27:27 clippy::incompatible_msrv "current MSRV (Minimum Supported Rust Version) is `1.39.0` but this item is stable since `1.65.0`"
target/lintcheck/sources/anyhow-1.0.86/src/backtrace.rs:27:27 clippy::incompatible_msrv "current MSRV (Minimum Supported Rust Version) is `1.39.0` but this item is stable since `1.65.0`"
target/lintcheck/sources/anyhow-1.0.86/src/backtrace.rs:27:27 clippy::incompatible_msrv "current MSRV (Minimum Supported Rust Version) is `1.39.0` but this item is stable since `1.65.0`"
target/lintcheck/sources/anyhow-1.0.86/src/backtrace.rs:27:27 clippy::incompatible_msrv "current MSRV (Minimum Supported Rust Version) is `1.39.0` but this item is stable since `1.65.0`"
target/lintcheck/sources/anyhow-1.0.8
@notriddle
notriddle / postels_law.md
Last active April 26, 2025 06:03
Postel's Law

The biggest mistake is treating Postel's Law as a suggestion. It's a law, just like Moore's Law, Hyrum's Law, Goodhart's Law, and the Law of Diminishing Returns.

In an ecosystem of interoperating implementations, accepting sloppy input and emitting strict output is the locally-optimal strategy to avoid your implementation being seen as the direct cause of problems. This is contingent on two "facts":

  • The upside to accepting sloppy input is immediate, while the downside is far away and diffuse.
  • Accepting sloppy input is a one-way ratchet. It's easy to add, sometimes, if it happens to be easy to do it with your current implementation strategy. But, once people start relying on it, it's very painful to remove.

This is a collective action problem, because, in an ecosystem where every other implementation is strict on both emitting and consuming input, the locally-optimal strategy is still Postel's Law, as long as bugs that are easy to work around exist. Advising individual development teams that "Postel

// need to escape specials
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions
const REGEX_SPECIALS = /[\$\(\)\*\+\.\/\?\[\\\]\^\{\|\}]/;
class EditDistanceCalculator {
constructor(string, limit) {
this.string = string;
this.current = [];
this.prev = [];
this.prevPrev = [];
this.matcherRegExp = new RegExp("^" + this.buildMatcherRegExp(string, limit) + "$");
@notriddle
notriddle / rustdoc-html-user-roles.md
Last active March 22, 2024 17:06
Rustdoc (HTML) roles and priority of constituents

Introduction

Note: this is not a policy doc. At least, not yet.

This is a pile of notes that should probably be integrated into the rustc-dev-guide at some point. These roles, at least for me, inform where and how I've designed features and pages in rustdoc.

With these roles written down, I'm going to try to avoid referring to a "rustdoc user" most of the time, because that's not usually specific enough. Rustdoc has three interfaces, with three different audiences, who, sometimes, overlap.

My [cmark-gfm][^c].

My [cmark-gfm][cmark-gfm][^c].

My [cmark-gfm][][^c].

My [cmark-gfm] [^c].

My [cmark-gfm[^c]].

@notriddle
notriddle / README.md
Created June 1, 2023 20:32
test case for GFM footnotes

Footnotes 1 [^many].

Footnotes

  1. first paragraph inside footnote

@notriddle
notriddle / diffpkg.bash
Last active February 15, 2022 21:34
A basic script I wrote for myself to compare package versions
#!/bin/bash
print-usage-and-die() {
echo "Usage: diffpkg.bash [cargo|npm] [pkg1] [pkg2]"
echo " pkg1 and pkg2 can have formats NAME-VERS, NAME@VERS, NAME:VERS, or NAME=VERS"
exit 1
}
extract-name() {
case "$1" in
@notriddle
notriddle / index.md
Last active March 12, 2021 19:57
How to speed up rustdoc in 2021

By "rustdoc", I mean the API documentation webapp used by Rust. The Book is rendered using a different application, called mdBook, and only some of this advice is really applicable to it.

I hope you take my copycat txties as the compliment that I intend, by the way.

Step 1: get the rust toolchain

The first step is to get the Rust code. To help compare the old version with the new one, I set up a separate worktree for the new version, and keep the old version around. It's a lot like cloning the repository twice, but it doesn't require two downloads.

user=notriddle

cd ~/Development

@notriddle
notriddle / filter-well-behaved-robots.sh
Last active March 5, 2020 20:57
Sorts out the unique non-robot IP addresses that requested style.css
#!/bin/sh
# The first step is to get a list of robot IP addresses
# We stash it in a file for later
awk -F' ' '/robots.txt/ {print $1}' /var/log/nginx/access.log.1 | sort | uniq > robots-ips.txt
# Also add a few known bots that don't necessarily get robots.txt from the same IP
grep -iE '(bingbot|BingPreview|msnbot|adbeat|ArchiveBot|YandexBot|Googlebot|Pinterestbot|Spider)' /var/log/nginx/access.log.1 | awk -F' ' '{print $1}' | sort | uniq > robots-ips.txt # The second step is to get a list of non-robot IP addresses
# This one is comparatively complicated, so let's dissect my awk syntax
# NR==FNR -- FNR is the line number ("record number") in the current file, while NR is the line number processed in total. If these are equal, then we're on the current file. # {a[$1]=1;next} -- we want to load the robots-ips.txt file into an array, a