Skip to content

Instantly share code, notes, and snippets.

View glowinthedark's full-sized avatar

glowinthedark glowinthedark

  • URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
  • HTTPError: HTTP Error 403: Forbidden
View GitHub Profile
/**
* Speak-Selected-Text — Web Speech API (SpeechSynthesis)
* Select text → floating 🔊 icon appears near the selection → click it to speak.
*/
(function () {
'use strict';
// ---- CONFIG ---------------------------------------------------------
const CONFIG = {
@glowinthedark
glowinthedark / python_opentelemetry_fake_client_emulation.py
Created August 6, 2026 20:37
Emit a Cucumber-style trace (suite > feature > scenario > steps) via OTLP/HTTP.
# /// script
# requires-python = ">=3.14"
# dependencies = [
# "opentelemetry-api>=1.44.0",
# "opentelemetry-sdk>=1.44.0",
# "opentelemetry-exporter-otlp-proto-http>=1.44.0",
# ]
# ///
"""Emit a Cucumber-style trace (suite > feature > scenario > steps) via OTLP/HTTP.
@glowinthedark
glowinthedark / gist:8e4cd2eee43aeda307ce7d7dffc2f414
Created July 21, 2026 21:16
whisper_mlx_bulk_macos_apple_silicon.py
#!/usr/bin/env python3
"""
Bulk transcription via the mlx-whisper *Python API* (Apple Silicon), tuned for
maximum recognition accuracy rather than throughput.
Why this exists alongside the shell wrapper:
mlx-whisper's CLI (v0.4.2) exposes NO --beam-size, NO --patience, and no
way to supply a temperature *tuple*. `--temperature` is a bare float, so
the fallback ladder inside transcribe() is unreachable and beam search is
@glowinthedark
glowinthedark / gist:ae6bfbd0624caafa5123a6a688ba944c
Last active June 6, 2026 14:18
git-repository-truncate-to-single-commit.sh
#!/usr/bin/env bash
# git_truncate.sh
# Truncates current branch to a single commit (squashes all history)
# and force-pushes to origin.
# Usage: ./git_truncate.sh [remote_name]
# Default remote: origin
set -euo pipefail
@glowinthedark
glowinthedark / Installing PyICU, libpostal, pypostal on Mac OS X 10.14+.md
Last active May 31, 2026 12:31 — forked from ddelange/Installing PyICU, libpostal, pypostal on Mac OS X 10.14+.md
Installation instructions for libicu-dev, PyICU, libpostal, pypostal on Mac OS X

Installing PyICU, libpostal, pypostal on Mac OS X 10.14+

libicu-dev (PyICU dependency)

brew reinstall pkg-config icu4c
@glowinthedark
glowinthedark / mlx_audio_text_to_speech_generate.py
Last active October 7, 2026 14:14
macOS TTS with Qwen3-TTS via MLX
#!/usr/bin/env python3
"""Long-form, artifact-free TTS with Qwen3-TTS on MLX (Apple Silicon).
MODE 1 — Voice cloning (--ref_audio + --ref_text) → Base model, ICL cloning:
./claude_generate_tts_longform_v3.py \
--input_file text.md \
--ref_audio hector_voice_sample.opus \
--ref_text hector_voice_sample.txt \
--language spanish \
@glowinthedark
glowinthedark / adb-pull-apk.sh
Created April 3, 2026 11:26
get APK from android device
#!/usr/bin/env bash
# Enforce strict error handling
set -euo pipefail
# uncomment for DEBUGGING ONLY
# set -exuo pipefail
# --- take package name as first arg ---
graph LR
    A["System Prompt (highest authority)"]:::sys
    B["Developer / Tool Instructions<br/>(when applicable)"]:::dev
    C[User Prompt]:::user
    D["Conversation History<br/>(recursive influence)"]:::hist

    A --> B --> C --> D

 classDef sys fill:#ffddcc,stroke:#cc7744,stroke-width:2px,color:#000;
@glowinthedark
glowinthedark / uri-percent-encode.sh
Last active February 24, 2026 12:46
uri-percent-encode.sh
printf '%s' "$*" | jq -sRr @uri
printf '%s' "$*" | xxd -p -c1 | sed 's/^/%/' | tr -d '\n'
printf "\npython\n"
python3 -c "import sys; print(''.join(f'%{b:02X}' for b in bytes('$*', 'utf8')))"
@glowinthedark
glowinthedark / whisper_bulk.py
Last active September 17, 2025 17:01
whisper bulk STT (speech-to-text) conversion, pass a glob to process multiple files
#!/usr/bin/env python3
import sys
from pathlib import Path
# from: https://community.openai.com/t/transcribe-lines-are-way-too-long-for-both-subtitles-and-karaoke/289059/7
print('loading whisper...', end='')
import whisper
from whisper.utils import get_writer