Skip to content

Instantly share code, notes, and snippets.

View alexsasharegan's full-sized avatar

Alex Regan alexsasharegan

View GitHub Profile
@alexsasharegan
alexsasharegan / ayu-colors.css
Created November 9, 2026 16:31
Ayu Light and Ayu dark color snippet for Obsidian's Default theme (matches Ghostty's Ayu themes)
/*
* Ayu colors for Obsidian (built-in Default theme stays active)
*
* Light -> Ayu Light
* Dark -> Ayu (the darkest variant, matching the Ghostty themes)
* Obsidian picks one from Settings > Appearance > Base color scheme
* ("Adapt to system" follows macOS light/dark).
*
* Scope: color variables only. No fonts, sizes, widths, spacing, radii, layout
* or component rules. No !important. No selectors other than the two theme
@alexsasharegan
alexsasharegan / 00-README.md
Last active November 9, 2026 06:50
Ghostty config + one-line zsh login banner (once per launch), with setup notes

Ghostty + a one-line login banner (zsh, macOS)

A dim one-line status banner that appears when you launch Ghostty, not every time you open a tab, plus the Ghostty config it lives with. If Ghostty restores several windows on launch, each one shows the banner.

Sat 2026-11-07 · day 311 · week 45 · up 2d 3h · disk 412G free (58% used) · battery 87% (AC)
@alexsasharegan
alexsasharegan / bytes.ts
Created November 15, 2025 16:49
TS toolkit
import { expectNever } from "./errors";
export type BinaryByteType =
| "B"
| "KiB"
| "MiB"
| "GiB"
| "TiB"
| "PiB"
| "EiB"
@alexsasharegan
alexsasharegan / nuke_s3.go
Created October 1, 2024 04:12
Drop all your S3 buckets like it's hot 🔥
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"log"
"os"
"os/exec"
@alexsasharegan
alexsasharegan / recovery.sh
Created February 10, 2020 16:36
System76 recovery script for nvidia errors.
sudo cryptsetup luksOpen /dev/nvme0n1p3 cryptdata
sudo lvscan
sudo vgchange -ay
sudo mount /dev/mapper/data-root /mnt
sudo mount /dev/nvme0n1p1 /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo cp /etc/resolv.conf /mnt/etc/
sudo chroot /mnt
@alexsasharegan
alexsasharegan / WrappedError.ts
Created January 3, 2020 17:51
Wrap errors using a linked list. Error burritos 🌯
export class WrappedError<ErrKind = any> extends Error implements Iterable<WrappedError | ErrKind> {
previous: ErrKind | null = null;
guid: Guid;
constructor(message: string, previous?: ErrKind) {
super(message);
// We update the error's name to distinguish it from the base Error.
this.name = this.constructor.name;
this.guid = `<${this.name}:empty>`;
// We add our reference to the original error value (if provided).
/**
* Creates a mapped type from the `Subject`
* that excludes all members with types
* that extend the `ExcludeType`.
*/
type ExcludeBy<Subject, ExcludeType> = {
[P in {
[K in keyof Subject]: Subject[K] extends ExcludeType ? never : K
}[keyof Subject]]: Subject[P]
};
Screen 0: minimum 8 x 8, current 5760 x 2160, maximum 32767 x 32767
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 597mm x 336mm
3840x2160 60.00*+ 29.98
2560x1440 59.95
1920x1200 59.88
1920x1080 60.00 59.94 50.00 23.98
1680x1050 59.95
@alexsasharegan
alexsasharegan / idleMap.ts
Created June 3, 2019 18:39
Schedule multiple promise-based tasks on idle browser time.
port async function idleMap<Item, Output>(
iterable: Iterable<Item>,
op: (item: Item) => Promise<Output>
): Promise<Output[]> {
return new Promise((resolve) => {
let iter = iterable[Symbol.iterator]();
let buf: Output[] = [];
async function process(deadline: RequestIdleCallbackDeadline) {
do {
@alexsasharegan
alexsasharegan / intersection-support.js
Last active May 16, 2019 22:38
Adds a window global for IntersectionObserver support at `Symbol.for("@@support.IntersectionObserver")`.
window[Symbol.for("@@support.IntersectionObserver")] = (function(w, k) {
let y = k.io in w && k.en in w && k.ra in w[k.en][k.pr];
if (!y) {
return false;
}
if (!(k.ix in w[k.en][k.pr])) {
Object.defineProperty(w[k.en][k.pr], k.ix, {
get() {
return this[k.ra] > 0;
},