See https://research.swtch.com/field for a primer on this 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
// ghost-rider rotates options inside a Ghostty config file. | |
// It expects the config file to have a specific format, where options are defined | |
// in a comment line starting with "# gr: " followed by a comma-separated list of | |
// options, and the actual option line that follows it. The script will rotate | |
// the option to the next one in the list each time it is run. | |
// The specific option to rotate can be specified with the -opt flag. | |
// Invoking this with a hotkey manager such as skhd allows for easy | |
// cycling through options like themes or background opacity in ghostty. |
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 | |
target_bucket=some-bucket-name-here | |
upload-file() { | |
local file_to_upload="$1" bucket="$2" | |
# metadata | |
contentType=$(file --brief --mime-type "$file_to_upload") | |
dateValue=$(date -R) |
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
[alias] | |
# branches: List recent branches sorted by date | |
# ${COLUMNS} is the standard environment variable to use to get the terminal's width. Unfortunately | |
# git sanitizes that away. git 2.31 will have a way to keep that variable. For now, extract it from | |
# the environment via stty. The below adds 20 to that value to account for the overhead of ANSI | |
# color sequences. | |
branches = !git for-each-ref refs/heads \ | |
--color=always \ | |
--sort=-committerdate \ | |
--format='%(HEAD)%(color:bold blue)%(refname:short)|%(color:green)%(committerdate:relative)|%(color:blue)%(authorname)|%(color:reset)%(subject)' \ |
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
local wezterm = require 'wezterm' | |
--~~ customizing themes for translucency | |
local nordCoal = wezterm.get_builtin_color_schemes()['nord'] | |
nordCoal.background = '#000000' | |
wezterm.on('toggle-opacity', function(window, pane) | |
local overrides = window:get_config_overrides() or {} | |
local opacity = overrides.window_background_opacity or 1 |
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
// Ray Lee 2022 August 22 ~ license CC0 | |
#ifndef circular_queue_h | |
#define circular_queue_h | |
#include <stdint.h> | |
#include <stddef.h> | |
/* There are two ways a circular queue can deal with a request to enqueue |
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
// Package letterbag provides operations on bags of letters. | |
package letterbag | |
import "errors" | |
// This implementation trades off perfect accuracy for speed and space. For a | |
// more straightforward version substitute `type Bag [26]int` and adjust | |
// accordingly. | |
// | |
// Below the 'a' to 'z' alphabet is represented by 26 prime numbers. Words are |
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 | |
# Create a list of pages from the website, one url per line, in a file named "pages". Easiest | |
# way for small sites is to get them from the admin interface, open each page in a tab then | |
# copy all tab URLs to the clipboard via chrome extension: | |
# https://chrome.google.com/webstore/detail/copy-all-urls/djdmadneanknadilpjiknlnanaolmbfk?hl=en | |
# Have ripgrep and wget handy. The heavy lifting is done by an html to markdown lib, wrapped here: | |
# https://github.com/suntong/html2md#usage | |
for page in $(cat pages); do |
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
package main | |
// zipguess.go | |
// reads a tsv file, one set of possibilities per line | |
// one possibile segment is chosen from each line in order | |
// and concatenated together into a guess | |
import ( | |
"flag" |
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
# Reconstructed via infocmp from file: /home/ray/.terminfo/x/xterm-kitty | |
xterm-kitty|KovIdTTY, | |
am, ccc, hs, km, mc5i, mir, msgr, npc, xenl, | |
colors#256, cols#80, it#8, lines#24, pairs#32767, | |
acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, | |
bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, | |
clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M, | |
csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, | |
cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, | |
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, |
NewerOlder