Skip to content

Instantly share code, notes, and snippets.

View BenMcLean's full-sized avatar

Benjamin McLean BenMcLean

View GitHub Profile
@BenMcLean
BenMcLean / compress-3ds.bat
Last active March 15, 2024 13:34
7-zip batch
@ECHO OFF
cd %~dp0
for /R %%F in (*.3ds) do ( "c:\Program Files\7-Zip\7z.exe" a "%%F.7z" "%%F" & if not errorlevel 1 del "%%F" )
@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 / 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 / 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 / KnockOutKitMaker.bat
Last active June 22, 2023 07:33
Teenage Engineering PO-33 Pocket Operator KO Sampler/Sequencer Kit Maker
@ECHO ON
cd %~dp0
set /a missing=F
if "%~2" == "" (
set missing=T
) else (
if "%~1" == "" ( set missing=T )
)
if "%missing%" == "T" (
echo At least two input files must be specified.
@BenMcLean
BenMcLean / powershell.bat
Last active October 30, 2022 22:57
Launch Powershell script .ps1 from identically named batch script .bat
@ECHO OFF
cd %~dp0
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%~dpn0.ps1' %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