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 bash | |
# rm-safe: A safer 'rm' that moves files to trash | |
# Version: 4.0 (Refactored with integrated tests) | |
set -uo pipefail | |
# --- Configuration --- | |
readonly SCRIPT_VERSION="4.0" | |
readonly OS="$(uname)" | |
readonly USER_ID="$EUID" |
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 bash | |
# find_github_forks_with_file | |
# Default values | |
REPO="" | |
FILE_TO_SEARCH="flake.nix" | |
MAX_JOBS=10 | |
SCRIPT_NAME=$(basename "$0") | |
# Help function |
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 luajit | |
--[[ | |
name-value-to-table-lua: Read lines like FOO=bar and emit a pretty table. | |
Supports -i/--input <file> (or - for stdin), -o/--output <file> (or - for stdout), | |
--help, --test, and optional --key-width <n> --val-width <n>. | |
]] | |
local function print_help() | |
io.stdout:write([[Usage: name-value-to-table-lua [-i file] [-o file] [--key-width N] [--val-width N] |
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
export const OCR_SYSTEM_PROMPT = ` | |
Convert the following document to markdown. | |
Return only the markdown with no explanation text. Do not include delimiters like \`\`\`markdown or \`\`\`html. | |
RULES: | |
- You must include all information on the page. Do not exclude headers, footers, charts, infographics, or subtext. | |
- Return tables in an HTML format. | |
- Logos should be wrapped in brackets. Ex: <logo>Coca-Cola<logo> | |
- Watermarks should be wrapped in brackets. Ex: <watermark>OFFICIAL COPY<watermark> | |
- Page numbers should be wrapped in brackets. Ex: <page_number>14<page_number> or <page_number>9/22<page_number> |
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 bash | |
### jpegxl: a bash function to make conversions to/from jpegxl easier! | |
# Silence function - runs a command silently but preserves exit code | |
silence() { | |
"$@" >/dev/null 2>&1 | |
return $? | |
} |
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
needs() { | |
command -v "$1" > /dev/null || { >&2 printf "%s is required- not installed or in PATH; %s\n" "$1" "${@:2}"; return 1; } | |
} | |
_generate_curl_api_request_for_please() { | |
needs jq; | |
local request args timeout model curl; | |
local curl=${CURL:-curl}; | |
local model=${OPENAI_MODEL:-gpt-4o}; | |
local timeout=${OPENAI_TIMEOUT:-30}; |
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
Peter: Does any database do real nested transactions, instead of just savepoints or what have you? | |
Claude: Ah, my fellow transaction theory nerd! | |
Most databases indeed just fake it with savepoints or MVCC shenanigans. However, I'll raise you one better: FoundationDB (before Apple acquired and neutered it) actually implemented true nested transactions through a clever distributed protocol. The trick was that each subtransaction maintained its own read/write sets that would be merged upward on commit. | |
But here's where it gets interesting (and where I suspect you'll appreciate the functional angle): The cleanest theoretical model for nested transactions comes from the world of Software Transactional Memory (STM), particularly Haskell's implementation. It treats transactions as pure values that can be composed and nested arbitrarily, with proper isolation guarantees. | |
I'd bet with your Elixir background you've played with Mnesia's "activity" blocks? While not quite as mathematically elegant as Haskell's STM, it's |
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
# note: does not currently work? | |
{ pkgs ? import <nixpkgs> { } }: | |
let | |
rocPkgs = pkgs.fetchFromGitHub { | |
owner = "roc-lang"; | |
repo = "roc"; | |
rev = "main"; # Change to a specific commit or tag for stability | |
sha256 = "sha256-11yw9xh1719smxbp0ia03kkv6hrvw4l6hhvxjxa4w2i7wc2r6yqy"; # You can fetch the sha256 from `nix-prefetch-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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Conversation</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
background-color: #f9f9f9; |
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 bash | |
# OK, why tabs? Why resurrect this age-old nerd debate again? | |
# Very simple: It's an accessibility issue: | |
# https://adamtuttle.codes/blog/2021/tabs-vs-spaces-its-an-accessibility-issue/ | |
# To set the default tab width on your terminal (which unfortunately defaults to 8), | |
# run: `tabs -2` (or whatever width you want), possibly in your dotfiles. | |
# is AWK set to anything? If not, prefer frawk, then gawk, then awk | |
[ -z "${AWK}" ] && export AWK=$(command -v frawk || command -v gawk || command -v awk) |
NewerOlder