Skip to content

Instantly share code, notes, and snippets.

View BenMcLean's full-sized avatar

Benjamin McLean BenMcLean

View GitHub Profile
@BenMcLean
BenMcLean / ShadedColorRect.cs
Last active December 15, 2023 00:58
Draw a procedurally-generated palette-indexed texture using a shader in Godot.
public partial class ShadedColorRect : ColorRect
{
public const string GodotShaderCode = @"
shader_type canvas_item;
render_mode blend_disabled;
uniform vec4[7] u_palette;
uniform sampler2D u_texture : filter_nearest;
void fragment(){
vec2 texture_size = vec2(textureSize(u_texture, 0));
//COLOR = texture(u_texture, (floor(UV * texture_size) + .5) / texture_size);
@BenMcLean
BenMcLean / NoHyphensForJellyfin.py
Last active September 12, 2023 14:09
Replace hyphens in Jellyfin movie titles with colons.
import argparse
import glob
import os
import sys
import xml.etree.ElementTree
parser = argparse.ArgumentParser(description='Replaces hyphens in Jellyfin movie titles with colons instead.')
parser.add_argument('-f', '--folder', metavar='folder', type=str, nargs=1, required=True, default=[1], help='Root directory')
def error(msg, exitcode=3):
print(msg, file=sys.stderr)
sys.exit(exitcode)
@BenMcLean
BenMcLean / JustTheTrackTitlesPlease.bat
Last active February 16, 2024 16:11
Gets just the track titles from MusicBrainz
@ECHO OFF
cd %~dp0
python.exe %~dpn0.py %1 %2 %3 %4 %5 %6 %7 %8
@PAUSE
@BenMcLean
BenMcLean / ciso.sh
Last active July 30, 2022 20:49
Bulk compress PSP ISOs to CSOs using https://github.com/sindastra/psp-mciso
#!/bin/bash
IFS='
'
for f in *.iso; do
if ./mciso-i386.linux 9 "$f" "$(basename -s .iso "$f").cso"; then
rm $f
fi
done
#!/bin/bash
IFS='
'
for f in *.png; do
mv "$f" "$(basename -s .png "$f").m3u.png"
done
@BenMcLean
BenMcLean / createcd.bat
Created July 30, 2022 02:39
Drag and drop .cue files of CD images to compress to .chd using chdman.exe from https://github.com/umageddon/namDHC
@ECHO OFF
cd %~dp0
chdman.exe createcd -i %1 -o "%~n1.chd"
@PAUSE
@BenMcLean
BenMcLean / update-google-dyndns.sh
Last active March 3, 2024 12:32 — forked from drewchapin/update-google-dyndns.sh
A shell script to update the public IP address of a Google DynDNS hostname.
#!/bin/bash
# Google Domains provides an API to update a DNS "Synthetic record". This script
# updates a record with the script-runner's public IP, as resolved using a DNS
# lookup.
#
# Google Dynamic DNS: https://support.google.com/domains/answer/6147083
# Synthetic Records: https://support.google.com/domains/answer/6069273
# Original script: https://gist.github.com/cyrusboadway/5a7b715665f33c237996
# Original modified script: https://gist.github.com/drewchapin/57d7039e30e8cc49e30bdc56a194f5bf
@BenMcLean
BenMcLean / youtube-audio-still-multi.bat
Last active May 27, 2022 15:14
Audio with picture and waveform display for YouTube
@ECHO OFF
cd %~dp0
for /f "eol=: delims=" %%F in ('dir /b /a-d *.flac ^| findstr /vixc:"%~nx0"') do ( ffmpeg.exe -i "%%F" -loop 1 -i Folder.jpg -filter_complex "[1]scale=-1:1080,pad=1920:1080:(ow-iw)/2:(oh-ih)/2[v]" -map "[v]" -map 0:a -c:a copy -c:v libx264 -movflags +faststart -strict -2 -shortest "%%F.mkv" )
@PAUSE
@BenMcLean
BenMcLean / quadraphonic-mka-to-surround51.bat
Last active May 27, 2022 15:15
Quadraphonic FLACs converted to fake 5.1 Surround FLACs
@ECHO OFF
cd %~dp0
for /f "eol=: delims=" %%F in ('dir /b /a-d *.mka ^| findstr /vixc:"%~nx0"') do ( ffmpeg.exe -i "%%F" -af "pan=5.1|FL=FL|FR=FR|BL=SL|BR=SR" "%%F.flac" )
@PAUSE
@BenMcLean
BenMcLean / compress-scans.bat
Created August 15, 2021 23:42
Compress Scans
@echo off
cd %~dp0
setlocal
setlocal enabledelayedexpansion
@echo off
for /d /r %%i in (Scans.) do (
@if exist "%%i" (
@set _scans=%%i
@echo !_scans!
cd %%i\..