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 powerSetIterative(array $items): array { | |
| $result = [[]]; | |
| foreach ($items as $item) { | |
| $combinations = []; | |
| foreach ($result as $combo) { | |
| $combo[] = $item; | |
| $combinations[] = $combo; | |
| } |
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 | |
| """Add a search engine to Zen Browser's preferences plist.""" | |
| import argparse | |
| import plistlib | |
| import sys | |
| from pathlib import Path | |
| from typing import Never | |
| DEFAULT_PLIST = Path.home() / "Library/Preferences/app.zen-browser.zen.plist" |
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 { spawn } from "node:child_process"; | |
| import { on, once } from "node:events"; | |
| async function spawnAsync(...args) { | |
| const subprocess = spawn(...args); | |
| /** @see https://github.com/sindresorhus/nano-spawn/blob/cc231e2c7/source/spawn.js#L24-L26 */ | |
| subprocess.once("error", () => {}); | |
| const until = ["spawn", "close"].reduce((out, event) => { | |
| out[event] = once(subprocess, event); |
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 nix | |
| #! nix shell nixpkgs#argc nixpkgs#jq --command bash | |
| # shellcheck shell=bash | |
| # vim: filetype=bash | |
| # @describe Bootstrap a launch agent plist | |
| # @option -c --command! Command to run | |
| # @option -C --cwd <DIR> Working directory | |
| # @option -e --env*, Environment variables | |
| # @option -l --label! Launch agent label | |
| # @option -n --name! Program name |
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 { registerHooks } from "node:module"; | |
| import { | |
| Worker, | |
| MessageChannel, | |
| receiveMessageOnPort, | |
| } from "node:worker_threads"; | |
| const channel = new MessageChannel(); | |
| const { port1: mainPort, port2: workerPort } = channel; | |
| mainPort.unref(); |
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 gh = (path) => new URL(path, 'https://nobsdelivr.private.coffee/gh'); | |
| const getJson = (url) => | |
| fetch(url, { headers: { Accept: "application/json" } }) | |
| .then((response) => response.json()) | |
| .catch((error) => { | |
| console.error(error); | |
| }); | |
| async function fetchInstances() { |