Skip to content

Instantly share code, notes, and snippets.

@fqidz
fqidz / batch-avif-encoder.ps1
Created June 22, 2025 19:00
Batch encode images to .avif
$current_dir = Get-Item -Path '.'
$input_dir = "$($current_dir.FullName)\images"
$output_dir = "$($current_dir.FullName)\output"
New-Item -ItemType Directory -Path $output_dir
$file_names = Get-ChildItem -Path $input_dir -Recurse | ForEach-Object { $_.FullName }
$output_file_names = Get-ChildItem -Path $output_dir -Recurse | ForEach-Object { $_.FullName }
$max_threads = 8
@fqidz
fqidz / calibre-open-books-cli.sh
Last active October 30, 2024 16:26
Calibre CLI Terminal Open Books Library
# List and open books from your calibre library using bash
# -----------------
# Requirements:
# sqlite, jq, fzf, fd
# -----------------
# Put this function inside your ~/.bashrc or ~/.zshrc,
# source the ~/.bashrc or ~/.zshrc file or restart the terminal,
# then type `books` to use the function.
function books {
@fqidz
fqidz / .bashrc
Created March 31, 2024 09:14
Simple bash alias to activate virtualenv anywhere inside git repo/tree
alias venva='git_venv_activate'
git_venv_activate(){
GIT_TOPLEVEL_DIR=`git rev-parse --show-toplevel 2> /dev/null` # get absolute path of the top-level directory of the working tree
if [ -z "$GIT_TOPLEVEL_DIR" ]; then
echo "Execute inside a git repository"
else
source $GIT_TOPLEVEL_DIR/.venv/bin/activate
fi
}