Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| # Requires pydub (with ffmpeg) and Pillow | |
| # | |
| # Usage: python waveform.py <audio_file> | |
| import sys | |
| from pydub import AudioSegment | |
| from PIL import Image, ImageDraw |
I’ve written a newer optimized 2026 version of this guide with a faster setup using Zinit + Starship and improved plugin loading.
This version avoids slow shell startups and works better with modern Zsh setups.
Updated guide: https://gist.github.com/n1snt/2cccc8aa5f7b645a7628d3512c70deb6
| # https://www.fosshub.com/MKVToolNix.html | |
| $ sudo apt install mkvtoolnix | |
| # Update the default audio track to the second one in all the files in the current directory | |
| $ for i in *; do if [[ $i == *.mkv ]]; then mkvpropedit "$i" --edit track:a1 --set flag-default=0 --edit track:a2 --set flag-default=1; fi; done | |
| # If you have a single subtitle, and you want it to be default, then do: | |
| $ for i in *; do if [[ $i == *.mkv ]]; then mkvpropedit "$i" --edit track:s1 --set flag-default=1; fi; done | |
| # Merge two files into one |