Skip to content

Instantly share code, notes, and snippets.

@jamesWalker55
jamesWalker55 / copy-screenshot.js
Created August 28, 2025 12:15
Script for MPV to copy screenshot to clipboard. Requires `cb.exe` tool in PATH, from https://github.com/Slackadays/Clipboard
// copy-screenshot.ts
var COMMAND_NAME = "screenshot-to-clipboard";
var path = mp.utils.get_user_path("~/AppData/Local/Temp/mpv-screenshot-clipboard.png");
function main() {
print("Saving screenshot to " + path);
mp.commandv("osd-msg", "screenshot-to-file", path, "video");
mp.commandv("run", "cb", "cp", path);
}
mp.add_key_binding(undefined, COMMAND_NAME, main);
@jamesWalker55
jamesWalker55 / git-stage-stash-diff.sh
Last active October 9, 2025 10:52
If you have many local changes that should not be commited, stash those files then re-apply the stash to local changes. Then use this script to stage everything that is not in the stash.
# This relies on the latest stash having untracked files
# Always create stash with:
#
# git stash -u
#
# Always apply your stash with:
#
# git stash apply
#
# Never do `git stash pop`!
@jamesWalker55
jamesWalker55 / trim-backups.py
Created January 6, 2026 16:04
Python script to delete Reaper project backups according to a retention policy. Please edit `expected_working_dir`, `KEEP_LAST_X` and `POLICY` to your use case.
# /// script
# dependencies = [
# "retention-rules",
# ]
# ///
import logging
import os
import re