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
| #![feature(error_generic_member_access)] | |
| use i3_ipc::{event, reply, I3Stream}; | |
| use itertools::Itertools; | |
| use nix::sys::memfd::memfd_create; | |
| use nix::sys::memfd::MemFdCreateFlag; | |
| use std::backtrace::Backtrace; | |
| use std::cmp; | |
| use std::collections::HashMap; | |
| use std::error::Error; | |
| use std::fs::File; |
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
| interface Maplike<key, value> { | |
| get(key: key): [value] | undefined; | |
| set(key: key, value?: value): void; | |
| delete(key: key): boolean; | |
| } | |
| interface Setlike<value> { | |
| get(value: value): [unknown] | undefined; | |
| set(value: value): void; | |
| delete(value: value): boolean; |
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 { bench, do_not_optimize, run } from './node_modules/mitata/src/main.mjs'; | |
| const ub = 100_000; | |
| const adHoc = { | |
| [Symbol.iterator]() { | |
| return { | |
| i: 0, | |
| next() { | |
| return this.i < ub ? { value: this.i++ } : { done: true } |
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
| const retainment = new WeakMap<WeakRef<WeakKey>, unknown>(); | |
| export class MapWeak<K, V extends WeakKey> implements Map<K, V> { | |
| #map: Map<K, WeakRef<V>>; | |
| #finalizer = new FinalizationRegistry<K>(key => { | |
| this.#map.delete(key); | |
| }); | |
| constructor(entries?: Iterable<readonly [K, V]> | null | undefined) { | |
| const entriesWeak: ConstructorParameters<typeof Map<K, WeakRef<V>>>[0] = |
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
| function ordgroupIterable<reference, key>( | |
| refs: Accessor<Iterable<reference>>, | |
| keyFn: (ref: reference) => key | |
| ): Accessor<ReadonlyMap<key, Accessor<readonly reference[]>>> { | |
| const signals = createMemo((keyset: Map<key, Signal<readonly reference[]>>) => { | |
| const exists = new Set(); | |
| let changed = false; | |
| // Check for group creations | |
| const ord: key[] = []; |
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
| #!/bin/bash | |
| set -euo pipefail | |
| shopt -s lastpipe | |
| name="temporary-vault" | |
| already_set_path= | |
| path="$(pwd)" | |
| _usage() { | |
| local status=${1:-0} |
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
| (?(DEFINE) | |
| (?<S>[\x20\x9\xD\xA]+) | |
| (?<NameStartChar>[A-Za-z:_\xC0-\xD6\x{D8}-\x{F6}\x{F8}-\x{2FF}\x{370}-\x{37D}\x{37F}-\x{1FFF}\x{200C}-\x{200D}\x{2070}-\x{218F}\x{2C00}-\x{2FEF}\x{3001}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFFD}\x{10000}-\x{EFFFF}]) | |
| (?<NameChar>(?&NameStartChar)|[\-\.0-9\x{B7}\x{0300}-\x{036F}\x{203F}-\x{2040}]) | |
| (?<Name>(?&NameStartChar)(?&NameChar)*) | |
| (?<EntityRef>&(?&Name);) | |
| (?<PercRef>%(?&Name);) | |
| (?<Reference>(?&EntityRef)|(?&PercRef)) | |
| (?<AttValue>"(?:[^<&"]|(?&Reference))*"|'(?:[^<&']|(?&Reference))*'|[^"'`=<>\x20\x9\xD\xA]+) | |
| (?<Attribute>(?&Name)(?:=(?:(?&AttValue))?)?) |
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
| const cache = new Map<TemplateStringsArray | string, readonly [string, ...string[]]>(); | |
| export function dedent(tsa: TemplateStringsArray, ...substitutions: unknown[]): string { | |
| let segments = cache.get(tsa); | |
| if (!segments) { | |
| const dedupeKey = JSON.stringify(tsa); | |
| segments = cache.get(dedupeKey); | |
| if (!segments) { | |
| if (tsa.length === 0) throw new Error("Missing string segments"); | |
| const strings = [...tsa] as [string, ...string[]]; |
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
| type RFC9457ProblemOccurrence = { | |
| /** | |
| * A string containing a URI reference that identifies the problem type. | |
| * | |
| * Consumers MUST use this URI (after resolution, if necessary) as the problem type's | |
| * primary identifier. | |
| * | |
| * When this member is not present, its value is assumed to be "about:blank". | |
| * | |
| * If the URI is a locator (e.g., those with an "http" or "https" scheme), |