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 2026 Techcable <https://techcable.net> | |
| // SPDX-License-Identifier: MIT OR Apache-2.0 OR CC0-1.0 | |
| import java.util.List; | |
| import java.util.function.Predicate; | |
| import java.util.stream.IntStream; | |
| /// Categorizes ASCII characters. | |
| /// | |
| /// The categories are somewhat arbitrary, but could be useful. |
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 java.util.Locale; | |
| /// Utilities for case conversion | |
| public class CaseConversion { | |
| private CaseConversion() { | |
| } | |
| public static String convertPascalCaseToSnakeCase(String pascalCase) { | |
| if (pascalCase.indexOf('_') >= 0) return pascalCase; // already converted | |
| StringBuilder res = new StringBuilder(); |
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
| [ | |
| { | |
| "id": 3422528123, | |
| "node_id": "LA_kwDOAAsO6M7L_6J7", | |
| "url": "https://api.github.com/repos/rust-lang/rust/labels/-Clink-dead-code", | |
| "name": "-Clink-dead-code", | |
| "color": "712F83", | |
| "default": false, | |
| "description": "Linkage option: -Clink-dead-code" | |
| }, |
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
| #![allow(dead_code)] | |
| use std::panic::Location; | |
| #[track_caller] | |
| fn runtime_line() -> &'static u32 { | |
| Box::leak(Box::new(core::panic::Location::caller().line())) | |
| } | |
| #[track_caller] | |
| fn inline_const_line() -> &'static u32 { |
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
| use std::marker::PhantomData; | |
| use std::mem::ManuallyDrop; | |
| use std::ptr::NonNull; | |
| /// Check if growth is necessary. | |
| #[inline] | |
| pub fn needs_to_grow(capacity: usize, len: usize, additional: usize) -> bool { | |
| // https://github.com/rust-lang/rust/blob/1.89.0/library/alloc/src/raw_vec/mod.rs#L626-L628 | |
| additional > capacity.wrapping_sub(len) | |
| } |
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
| #!/usr/bin/env python3 | |
| """A command line interface to urllib.parse.urljoin""" | |
| import argparse | |
| from urllib.parse import urljoin | |
| def main() -> None: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("base", help="The base URL") |
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
| #!/usr/bin/env python3 | |
| """ | |
| Strip line comments from a file | |
| By default, this requires whitespace to surround a comment for it to be valid. | |
| This means that `a#a` is not a valid comment. | |
| """ | |
| from __future__ import annotations |
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
| #!/usr/bin/env python3 | |
| """ | |
| Print lines slowly | |
| Intended for testing command line interfaces | |
| """ | |
| import argparse | |
| import itertools | |
| import time |
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
| #!/usr/bin/env -S uv run --script | |
| # Extracts data from the first markdown table found in the input file, | |
| # converting it into CSV | |
| # /// script | |
| # dependencies = [ | |
| # "marko~=2.1" | |
| # ] | |
| # /// | |
| import csv | |
| 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
| #!/usr/bin/env fish | |
| set --local openssl_prefix $(brew --prefix openssl) | |
| set --local libssh_prefix $(brew --prefix libssh2) | |
| set -gx CFLAGS "-I$openssl_prefix/include -I$libssh_prefix/include -lssl -lssh2" | |
| set -gx LDFLAGS "-L$openssl_prefix/lib -L$libssh_prefix/lib -lssl -lssh2" | |
| if not test -f ./nim.cfg; or not test -f ./README.md | |
| echo "ERROR: Should be in chawan root directory" >&2; |
NewerOlder