Skip to content

Instantly share code, notes, and snippets.

View ttscoff's full-sized avatar
💭
Breathing

Brett Terpstra ttscoff

💭
Breathing
View GitHub Profile
@ttscoff
ttscoff / README.md
Last active August 19, 2026 19:38
Save Readwise highlights to DEVONthink

Readwise to DEVONthink

This script has moved to its own repository. Please download there.

@ttscoff
ttscoff / lexers.rb
Last active August 16, 2026 05:29
Find the perfect lexer to highlight your fenced code blocks and other fancy stuff. If you know the common name of a language or a common file extension for it, this script will tell you exactly what most syntax highlighters will recoghize.
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'optparse'
# Have you ever been adding code to a Markdown post and
# wondered what syntax label would give you the right
# highlighting for your fenced code block? This script can
# take either a file extension or a common name of a language
# and let you know what lexers are supported for it, as well
@ttscoff
ttscoff / linkding-cards.css
Last active July 9, 2026 18:11
Custom CSS to give linkding a dark, card-based layout
/*
Card-based layout for Linkding
Large images, fully clickable
Entire card selectable in bulk edit mode
Tags moved to expandable sidebar
Author: Brett Terpstra (https://brettterpstra.com)
GitHub: @ttscoff <https://github.com/ttscoff>
License: MIT
*/
@ttscoff
ttscoff / ithoughts-to-mermaid.md
Last active July 8, 2026 15:15
Convert iThoughts X mind map to Mermaid diagram. Save ithougts.md and python file to .cursor/mermaid, and ithoughts-to-mermaid.md to .cursor/commands

iThoughts to Mermaid Mindmap (Cursor command)

Convert an iThoughts .itmz mind map file into a Mermaid mindmap for display in Cursor.

Instructions

  1. Get the itmz path: The user may provide a path (e.g. from iCloud: ~/Library/Mobile Documents/iCloud~com~toketaware~ios~ithoughts/Documents/Map Name.itmz). If no path is given, ask for it.

  2. Run the converter:

@ttscoff
ttscoff / matrixish.sh
Created September 15, 2012 18:23
A Matrix-ish display for Bash terminal
#!/bin/bash
#
# matrix: matrix-ish display for Bash terminal
# Author: Brett Terpstra 2012 <http://brettterpstra.com>
# Contributors: Lauri Ranta and Carl <http://blog.carlsensei.com/>
#
# A morning project. Could have been better, but I'm learning when to stop.
### Customization:
blue="\033[0;34m"
@ttscoff
ttscoff / 256color.rb
Last active May 22, 2026 08:31
256-color hex intepretation for terminal colorization
#!/usr/bin/env ruby
# frozen_string_literal: true
# 256-color hex interpretation for terminal colorization
#
# Usage
# "text".color256(foreground, background)
#
# print "Colorize this".color256('#f7921e', '#666')
@ttscoff
ttscoff / imdown.bash
Created May 4, 2018 15:20
Bash functions for notifying when your internet connection comes back up
# Bash functions for notifying when your internet connection comes back up
# A truly atrocious way to get your attention
nag() {
while true; do
for phrase in "$@"; do
afplay /System/Library/Sounds/Ping.aiff
say "$phrase"
sleep 3
done
@ttscoff
ttscoff / massnippet.txt
Created March 18, 2012 20:52
Auto-redeem link for Mac App Store promo codes
macappstores://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/redeemLandingPage?code=XXXXXXXXX
@ttscoff
ttscoff / audio-search.rb
Last active March 23, 2026 15:25
Search audio files for text using whisper.cpp and ffmpeg
#!/usr/bin/env ruby
# A simple script to index and search audio files using whisper.cpp
# Saves a text file for each audio file with the transcript, and allows searching through them
# Usage:
# ruby audio-search.rb index [file.mp3] # Index a single file or all .mp3 files if no file is specified
# ruby audio-search.rb search [query] # Search for a query in the indexed transcripts, whole words in search order but allowing characters between
# Search can be fuzzy (words in any order) by adding --fuzzy or -f flag:
# ruby audio-search.rb search --fuzzy [query]
# Requires ffmpeg and whisper-cli to be installed and in the system PATH
require 'fileutils'
@ttscoff
ttscoff / onsetapp.rb
Last active March 17, 2026 12:58
Check which Setapp Apps you could be using
#!/usr/bin/env ruby
# encoding: utf-8
# Read /Applications/Setapp to get apps already installed
installed_setapp_apps = Dir.glob('/Applications/Setapp/*.app')
installed_setapp_apps.map! {|app|
File.basename(app,'.app')
}
# Grab the All Apps page from Setapp to get all available apps