Posts

script to create an EFI partition on a target bootdrive if none exists

After rsyncing your OS to the external drive, run this to create a boot partition. You MUST copy the OS first. #!/bin/bash # Ensure script is run as root if [ "$(id -u)" -ne 0 ]; then   echo "Please run this script as root (e.g. via sudo)."   exit 1 fi # Load USB device detection source /scripts/find_usb.sh || {   echo "Failed to load /scripts/find_usb.sh"   exit 1 } mountpoint="/media/$(logname)/$usb_uuid" efi_partition="${usb_disk}2" echo "This will FORMAT and INSTALL EFI SYSTEM PARTITION on $efi_partition" echo df -h | grep "$usb_disk" || echo "Warning: device not mounted yet." echo read -rp "Continue with formatting and EFI install on $efi_partition? (y/n): " confirm if [[ "$confirm" != "y" ]]; then   echo "Aborted."   exit 1 fi # Create EFI partition if it doesn't exist if ! lsblk "$efi_partition" &>/dev/null; then   echo "Creating EFI p...

script to backup entire drive and make it bootable

The script will: Auto-detect the USB device and UUID. Prompt you for confirmation after showing df -h . Run rsync , update the cloned /etc/fstab , bind-mount essential filesystems, Then chroot and auto-run grub-install and update-grub — all without further input. once you have run this script, run the efi installer script in another post. #!/bin/bash # Step 1: Detect USB disk usb_devs=() for dev in /sys/block/sd*; do     devname=$(basename "$dev")     [[ "$devname" =~ [0-9]$ ]] && continue     if ls -l /dev/disk/by-path/ | grep -w "$devname" | grep -q usb; then         usb_devs+=("/dev/$devname")     fi done # Step 2: Verify only one USB drive is connected if [ "${#usb_devs[@]}" -ne 1 ]; then     echo "Error: Found ${#usb_devs[@]} USB drives. Please ensure only one external USB drive is connected."     exit 1 fi usb_device="${usb_devs[0]}" usb_partition="${usb_device}1" usb_uuid=$(blki...

script to list drives by hardware name, type and mountpoint

 #!/bin/bash echo "Brand/Model - Device - Mountpoint - Connection" echo "-----------------------------------------------" for dev in /sys/block/sd*; do     devname=$(basename "$dev")     [[ "$devname" =~ [0-9]$ ]] && continue     model=$(cat "$dev/device/model" 2>/dev/null)     vendor=$(cat "$dev/device/vendor" 2>/dev/null)     devpath="/dev/$devname"     mountpoint=$(lsblk -no MOUNTPOINT "$devpath" 2>/dev/null | grep -v '^$' | head -n1)     # check if any symlink to this device exists in by-path with 'usb' in path     if ls -l /dev/disk/by-path/ | grep -w "$devname" | grep -q usb; then         connection="USB"     else         connection="ATA"     fi     echo "$vendor $model - $devpath - ${mountpoint:-not mounted} - $connection" done

annoying apt install command

 I don't know if you've seen apt go berserk asking you about whether to install package maintainer config files and blather on about what it is doing, it is way too verbose and annoying. This shellscript takes input as the apt package name and doesnt say anything except ok or fail #!/bin/bash export DEBIAN_FRONTEND =noninteractive apt-get install -y $1 > /dev/null && echo OK || echo FAIL

Automatically Fix Song Metadata and Filenames on Linux with Beets

 🎵 Automatically Fix Song Metadata and Filenames on Linux with Beets Tired of sorting through unknown MP3s with cryptic filenames like Track01.mp3? Sick of missing album info, incorrect genres, and zero cover art? Here's a clean way to batch-fix your music collection with open source tools — no manual editing required. ✅ What You’ll Use beets — the core tool that organizes, renames, and tags your music by matching against the MusicBrainz database. libchromaprint-tools — provides fpcalc, which generates audio fingerprints to identify unlabeled tracks. ffmpeg (optional) — used by beets for transcoding or embedded cover art processing. 🔧 Installation sudo apt update sudo apt install beets libchromaprint-tools ffmpeg 🚀 One Command to Organize It All beet import /path/to/your/music/ Beets will: Fingerprint each file Query MusicBrainz for metadata Rename files (e.g., Artist - Title.mp3) Write correct ID3/metadata tag Optionally move files into organized folders 📁 Example Output Your ...

yt-dlp flakes and demands a login

 # If yt-dlp gives login/CAPTCHA error, run the following: python3 -m pip install --upgrade --force-reinstall yt-dlp python3 -m pip install --upgrade cffi sudo apt install python3-cffi yt-dlp --cookies-from-browser chrome "VIDEO_URL_HERE"

How to Sync an iPod Touch (iOS 9.3.5) with macOS 10.13 and iTunes 12.8.3.1

Last tested: May 2025 | Hardware: iPod Touch 5th Gen + MacBook Pro 17" (2010) If you're trying to get your old iPod Touch to sync with your Mac running macOS High Sierra (10.13), you might run into a frustrating "Ask Apple" message or find the iPod icon greyed out in iTunes. Here's how to fix it. ✅ Prerequisites macOS 10.13 with iTunes 12.8.3.1 iPod Touch 5th gen running iOS 9.3.5 USB cable (original or good quality third-party) 🧩 Fix Steps 1. Clear device pairing lock In Terminal , run: sudo rm -rf /var/db/lockdown/* This clears old pairing records between macOS and the iPod. 2. Reset trust on iPod On your iPod: Go to Settings → General → Reset → Reset Location & Privacy Then reboot it: Hold Home + Power until the Apple logo appears. 3. Reconnect and trust Plug the iPod back in. When prompted, tap “Trust” on the iPod screen. 4. Fix stuck iTunes connection (if needed) If iTunes still refuses to connect: Res...