Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from xml.dom import minidom
from os import getenv, listdir
from os.path import exists,basename,normpath,splitext
import psycopg2,pathlib,datetime
from glob import glob
# directory where your playlists are
outDir = "/srv/funkwhale/data/music/"
@theandrewbailey
theandrewbailey / avifify.sh
Last active October 1, 2024 11:38
avifify.sh - Encode PNGs into web optimized AVIF images
#! /bin/bash
set -e
readonly b="\033[1m" # bold text
readonly i="\033[3m" # italic text
readonly n="\033[0m" # normal text
readonly r="\033[0;31m" # red text
readonly u="\033[4m" # underlined text
readonly regexWidthSteps="×[1234567890¼½¾]+\.png$"
@theandrewbailey
theandrewbailey / encmount.sh
Created May 1, 2021 00:46
bash script to unlock, mount, backup to, unmount, and lock an encrypted external drive
#! /bin/bash
backupfrom="/srv/smb/"
blockdev=${1:-/dev/sdd1}
permunlock=$(pkaction|grep org.freedesktop.udisks2.encrypted-unlock)
permmount=$(pkaction|grep org.freedesktop.udisks2.filesystem-mount)
if [[ -z "$permunlock" ]] || [[ -z "$permmount" ]]; then
echo "enter disk password first, then login password twice"
echo "login password prompts can be eliminated via polkit"