Skip to content

Instantly share code, notes, and snippets.

@Akczht
Akczht / renamer.py
Last active August 6, 2024 01:55
Renames files in a directory using names from a text file.
import os
import pathlib
def rename_files(directory, names_file, add_numbers=False, keep_extension=True):
"""Renames files in a directory using names from a text file, sorting files by name, optionally adding numbers with leading zeros, and optionally keeping extensions.
Args:
directory: The path to the directory containing the files.
names_file: The path to the text file with new names.
add_numbers: If True, adds numbers to the new file names.
@Akczht
Akczht / renamer.sh
Last active December 30, 2024 22:01
A bulk file renaming script using bash, which renames files from a text file containing names
#!/bin/bash
set -e
directory="/path/to/your/directory"
names_file="/path/to/your/names.txt"
# Read new names into an array
new_names=()
while IFS= read -r line; do
new_names+=("$line")
@Akczht
Akczht / mpv-build.sh
Last active December 30, 2024 22:01
How to compile mpv.app on macOS
#!/bin/bash
set -e
findcd() {
local search_string="$1"
target_dir=$(find . -maxdepth 1 -type d -name "$search_string*" -print -quit)
if [ -n "$target_dir" ]; then
@Akczht
Akczht / ffmpeg-compile-macos.txt
Last active April 18, 2024 11:58
FFmpeg Compilation macOS
Compiling FFmpeg with Build Options
This guide outlines the steps to compile FFmpeg with specific build options using the ./configure script.
Prerequisites
Ensure you have the following prerequisites installed on your system:
- GCC compiler
- Git
- GNU Make
@Akczht
Akczht / xld-config-reset.txt
Last active March 12, 2024 08:07
XLD Configuration Reset
To remove the old configuration of XLD (X Lossless Decoder) on a Mac by deleting two files, you can follow these steps:
1. Open Finder:
- Click on the Finder icon in your Dock or open a new Finder window.
2. Navigate to the XLD configuration files and delete the XLD configuration files:
- XLD configuration files are typically stored in the user's home directory.
- Go to the following paths, look for these files they are (currently) named something like: