No description
Find a file
2025-11-09 09:56:21 +01:00
scripts looks good for now 2025-11-09 09:53:50 +01:00
install.sh update README.md 2025-08-15 12:40:17 +02:00
README.md update readme 2025-11-09 09:56:21 +01:00

Overview

This repository is a toolkit of practical shell scripts for everyday development, media handling, and system management. Installation is straightforward—clone the repo, run the installer, and all scripts are linked system-wide. Included scripts:

  • tmux-name-window Quickly rename the current tmux window after the current PWD.
  • tmux-sessionizer Quickly jump into a chosen project directory in a new tmux window using fzf.
  • add-worktree sets up a dedicated git worktree for a specific branch.
  • add-worktree-for-all-branches Creates local branches for all remotes and sets up dedicated Git worktrees for each.

  • install.sh Makes all scripts/ files executable and symlinks them into /usr/bin.
  • chtsh Lets you search programming languages and system utilities on cht.sh via an interactive fzf/tmux interface.
  • fastermp3 Speeds up all .mp3 files in the current directory by 1.5× using sox.
  • set-evn-git-identity Applies a predefined Git identity to all repos within a certain directory.
  • setmetadatamp3 Adds artist, album, year, and title ID3 tags to all .mp3 files in the current directory.
  • vpn-toggle Toggles WireGuard VPN connections on or off interactively.
  • datamine-zsh-history Analyzes your zsh history to reveal the most-used subcommands for a given CLI tool, ranked by frequency.
  • transcribe-yt - YouTube → Whisper → LLM Summarizer

Clone and Install

via ssh

git clone ssh://git@git.ramboe.io:9022/configuration/scripts.git "$HOME/ramboe_scripts" && \
cd "$HOME/ramboe_scripts" && \
. ./install.sh

or, via https:

git clone https://git@git.ramboe.io/configuration/scripts.git $HOME/ramboe_scripts && \
cd "$HOME/ramboe_scripts" && \
. ./install.sh

Scripts

install.sh

The install.sh script makes all files in scripts/ executable and symlinks them into /usr/bin for system-wide access. Run it from the repository root so $PWD/scripts resolves correctly.

scripts/add-worktree-for-all-branches

This script fetches all remote branches, creates local tracking branches for any that dont exist, and then sets up separate Git worktrees for each branch in sibling directories. Run it from the repository root to organize all branches into dedicated folders.

scripts/chtsh

from inside tmux

This script uses fzf to let you choose a programming language or system utility, prompts for a query via whiptail, and then opens a tmux split showing results from cht.sh. Languages use slash-style queries (/), while core utilities use tilde-style (~).

Use it in your .zshrc like so

hit F5 to start chtsh query

# Define a function to run the chtsh script
run_cheatsheet() {
    /usr/bin/chtsh
    zle redisplay
}

## Bind F5 to the run_cheatsheet function
zle -N run_cheatsheet
bindkey "${terminfo[kf5]}" run_cheatsheet

scripts/fastermp3

This script processes all .mp3 files in the current directory, creating faster versions (1.5× speed) with filenames prefixed by faster_. Requires sox to be installed

scripts/set-evn-git-identity

Interactive script: uses fzf to let you pick a parent directory (from the current directorys immediate subfolders), then prompts for user.name and user.email and applies them to every Git repo directly under that parent. Requires fzf; non-Git folders are skipped.

scripts/setmetadatamp3

This script prompts for an artist and album name, then applies ID3 tags (artist, album, year, and title) to all .mp3 files in the current directory using id3v2. The title is taken from each filename.

scripts/tmux-name-window

from inside tmux

This script renames the current tmux window to match the name of the directory youre in, making it easier to identify windows by their working folder.

scripts/tmux-sessionizer

from inside tmux

This script uses fzf to let you interactively pick a directory from several predefined paths, then opens a new tmux window named after that directory and starts in it. Its a quick way to jump into a project folder within your current tmux session.

Use it in your .zshrc like so

DEFAULT_DIRS - hit Ctrl-f to fzf through predefined directories

# Define a function to run the tmuxsesstionizer script
run_tmuxsesstionizer() {
    /usr/bin/tmux-sessionizer
    zle redisplay
}

# Bind Ctrl-f to the run_tmuxsesstionizer function
zle -N run_tmuxsesstionizer
bindkey '^F' run_tmuxsesstionizer

. - hit F3 to fzf down from the current directory

run_tmuxsesstionizer_here() {
  /usr/bin/tmux-sessionizer .
  zle redisplay
}
zle -N run_tmuxsesstionizer_here

# Bind F3 to the run_tmuxsesstionizer_here function
bindkey "${terminfo[kf3]}" run_tmuxsesstionizer_here

add-worktree

A small helper script to quickly create a Git worktree for any branch, chosen via fzf.

Features

  • Fetches remote branches before selection
  • Lets you pick a branch with fzf, showing recent commits as a preview
  • Creates a local tracking branch if it only exists on origin/
  • Prevents duplicate worktrees and skips existing target directories
  • Places new worktrees in ../<repo>-<branch>

Usage

./add-worktree

vpn-toggle

This script toggles WireGuard connections. If a WireGuard interface is active, it brings it down; otherwise, it lists available .conf files in /etc/wireguard, lets you choose one, and activates it using wg-quick.

datamine-zsh-history

This script analyzes your zsh history to show which subcommands you use most for a given CLI tool (e.g. git, dotnet), grouping similar commands and ranking them by percentage.

Example:

datamine-zsh-history git
---
# git add        45.00% (9)
# git commit     30.00% (6)
# git status     25.00% (5)

transcribe-yt.sh

Overview

transcribe-yt.sh automates the entire workflow of:

  1. Downloading the audio from a YouTube video
  2. Transcribing it via your self-hosted Whisper API (AMD GPU-powered)
  3. Summarizing the transcript with your OpenWebUI (LLM) instance
  4. Saving everything neatly into dated folders under ~/Documents/yt-summaries/

It caches audio and transcripts for speed — only new videos or changed summaries require compute time.

🧩 Directory structure

After each run youll get something like:

~/Documents/yt-summaries/
├── cache/                       # Persistent cache
│   ├── my-video-title.wav        # Downloaded once
│   └── my-video-title.json       # Whisper transcript
└── 2025-11-04-101500/            # Timestamped run folder
    ├── source-url.txt
    ├── my-video-title.wav
    ├── my-video-title.json
    └── my-video-title.summary.md # Fresh summary each run

⚙️ Requirements

  • yt-dlp
  • jq
  • A running Whisper transcription API (e.g. https://whisper.ramboe.io/transcribe)
  • A running OpenWebUI (or Ollama-compatible) API endpoint

🔐 Required environment variables

Variable Description
YT_SUMMARIES_PATH path on your system to save the summaries to
WHISPER_API_URL Whisper API endpoint see this project to run one your self
WHISPER_API_USER Basic auth username for Whisper
WHISPER_API_PASS Basic auth password for Whisper
OWEBUI_URL OpenWebUI API endpoint see this project to run one yourself
OWEBUI_API_KEY API key for OpenWebUI
OWEBUI_MODEL (optional) Model to use (default mistral:7b-instruct)

You can export these in your shell profile, for example:

export YT_SUMMARIES_PATH="YT_SUMMARIES"
export WHISPER_API_URL="https://<url>"
export WHISPER_API_USER="myuser"
export WHISPER_API_PASS="mypassword"
export OWEBUI_URL="https://<url>"
export OWEBUI_API_KEY="your_api_key_here"
export OWEBUI_MODEL="mistral:7b-instruct"

🚀 Usage

./transcribe-yt.sh <YouTube_URL> [model]

Examples:

./transcribe-yt.sh "https://www.youtube.com/watch?v=VsDXv7ipNJo"
./transcribe-yt.sh "https://youtu.be/abcd1234" gemma3:12b

🧠 Behavior summary

Step Action Cached?
1 Downloads YouTube audio (.wav)
2 Transcribes via Whisper → .json
3 Summarizes via OpenWebUI → .summary.md (always new)

Each new run gets a timestamped folder with all artifacts, so you can keep multiple summaries for the same video (useful when tweaking prompts or models).

🧹 Optional cleanup

If you ever need to reclaim space:

rm -rf ~/Documents/yt-summaries/cache

This will force re-downloads and re-transcriptions on the next run.

Example output

[INFO] Fetching video metadata...
[INFO] Video title: AI in 2025: What's Next?
[INFO] Summarizing transcript with model: mistral:7b-instruct
✅ Summary written to: ~/Documents/yt-summaries/2025-11-04-101500/ai-in-2025-what-s-next.summary.md

Thats it — run the script, get high-quality Markdown summaries of any YouTube video, fully GPU-accelerated and locally stored.