This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: Copyright 2020-2024, Contributors | |
# SPDX-PackageHomePage: https://gist.github.com/dmyersturnbull | |
# SPDX-License-Identifier: Apache-2.0 | |
"""Collection of regex strings that JSON keys can be matched against. | |
All patterns are maximally high-performance (use the fewest CPU cycles and the least memory). | |
Includes `kebab-case`, `snake_case`, `camelCase`, `PascalCase`, etc. | |
Also has a blacklist of "problem" Unicode code points, which we define as | |
control characters, surrogate characters, private use area (PUA) code points, and non-characters. | |
There are two very general patterns, which use this blacklist: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Runs an executable in a Keg-only Brew package that's not in PATH. | |
# Finds an executable named `$1` or `g$1` in formula `$1`, `g$1`, `coreutils`, or `findutils`. | |
# Note: Always searches in that order. This is significant for commands starting with `g`. | |
# Usage: gnu <command> [<args ...>] | |
gnu() { | |
if (( $# == 0 )); then | |
printf >&2 "\e[0;1;31mUsage: %s <command> [args...]\e[0m\n" "${FUNCNAME[0]}" | |
return 2 | |
fi | |
if ! command -v brew > /dev/null 2> /dev/null; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: Copyright 2025, Contributors | |
# SPDX-PackageHomePage: https://gist.github.com/dmyersturnbull | |
# SPDX-License-Identifier: MIT OR CC0-1.0 | |
# /// script | |
# requires-python = ">=3.13" | |
# dependencies = ["loguru>=0.7", "packaging>=25", "semver>=3.0"] | |
# /// | |
"""Intro to the strange world of PEP 440 version specifiers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: Copyright 2020-2024, Contributors | |
# SPDX-PackageHomePage: https://gist.github.com/dmyersturnbull | |
# SPDX-License-Identifier: Apache-2.0 | |
""" | |
Tool to diff two order-independent sets of lines. | |
""" | |
import math | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Recommended exit codes from {@code /usr/include/sysexits.h}. | |
*/ | |
public final class ExitStatus { | |
public static final int OK = 0; | |
public static final int GENERIC_ERROR = 1; | |
public static final int BASE = 64; | |
public static final int USAGE = 64; | |
public static final int NO_DATA = 65; | |
public static final int NO_INPUT = 66; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.backup | |
/data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[metadata] | |
description-file = "README.md" | |
[build-system] | |
requires = ["poetry>=1.0", "coverage[toml]"] | |
build-backend = "poetry.masonry.api" | |
######################################################################################### | |
# Poetry metadata |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse, sys, re, logging | |
from pathlib import Path | |
from typing import Mapping, Any, Sequence, Collection | |
from typing import Tuple as Tup | |
logger = logging.getLogger('paperpile-latex') | |
class Paperpiler: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"code": "100", | |
"phrase": "Continue", | |
"description": "The initial part of a request has been received and has not yet been rejected by the server.", | |
"spec_title": "RFC7231#6.2.1", | |
"spec_href": "https://tools.ietf.org/html/rfc7231#section-6.2.1" | |
}, | |
{ | |
"code": "101", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
from pathlib import Path | |
def fix(path: Path, accent_file: Path, output_path: Path) -> None: | |
""" | |
Reformat my bib file. | |
* Remove PMC and DOI URLs because they're listed as IDs anyway. | |
* Replace accent-like escape characters with their UTF equivalents. I mean, it's 2020. |
NewerOlder