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 uv run --script | |
# /// script | |
# requires-python = ">=3.9" | |
# dependencies = [ | |
# "requests", | |
# "watchdog", | |
# ] | |
# /// | |
import argparse |
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 | |
# Configuration | |
WATCH_DIR="$HOME/Library/Group Containers/group.com.apple.VoiceMemos.shared/Recordings" | |
ENDPOINT="http://127.0.0.1:8080" # Replace with your actual endpoint | |
API_KEY="your-api-key" # Optional: Add if your endpoint requires authentication | |
# State file to track processed files | |
STATE_FILE="$HOME/.voice_memos_processed" | |
touch "$STATE_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
/** | |
* Peek at the next chunk of data in the stream without consuming it. | |
* @param input The input stream to read from. | |
* @param length The number of bytes to peek. | |
* @returns A promise that resolves to the peeked data. | |
*/ | |
async function peek(input: Readable, length: number): Promise<Buffer> { | |
// Try synchronous read first | |
const immediateBuffer = input.read(length) | |
if (immediateBuffer) { |
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 ExtraOpts { | |
class?: string | string[]; | |
data?: Record<string, string>; | |
} | |
type TagName = keyof HTMLElementTagNameMap; | |
type Tag = HTMLElementTagNameMap; | |
type Opts<K extends TagName> = Partial<Tag[K]> & ExtraOpts; | |
type Child = Node | 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
import GUI from "lil-gui"; | |
import { div } from "./DOM"; | |
let id = 0; | |
function getUniqueID(): string { | |
return `element-${id++}`; | |
} | |
export class BaseElement extends HTMLElement { | |
gui?: GUI; |
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 random | |
import string | |
import time | |
from typing import Tuple | |
import psycopg2 | |
from psycopg2.extensions import cursor | |
from rich.console import Console | |
from rich.table import Table |
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 io | |
import logging | |
import os | |
import time | |
from datetime import datetime, timedelta | |
import gtts | |
import irc.bot | |
import sounddevice as sd | |
import soundfile as sf |
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 itertools | |
from sys import stdout | |
from typing import Self | |
def emoji_bool(b: bool): | |
return b and "✅" or "❌" | |
class Node: |
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 re | |
word_numbers = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] | |
real_numbers = [str(i) for i in range(1, 10)] | |
numbers_re = "|".join(real_numbers + word_numbers) | |
first_re = rf"^.*?({numbers_re}).*$" | |
last_re = rf"^.*({numbers_re}).*?$" |
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 re | |
import subprocess | |
DIVIDER_RE = r"^.+\s+[0-9a-f]+$" | |
ITEM_RE = r"^.+\s+.+\s+.*$" | |
def get_line_changes_over_time(): | |
process = subprocess.Popen( | |
[ |
NewerOlder