Skip to content

Instantly share code, notes, and snippets.

View xthesaintx's full-sized avatar

Stephen Garrett xthesaintx

View GitHub Profile
@xthesaintx
xthesaintx / gist:544a7d5e8c27cac741b0776ceacd3db0
Last active August 23, 2025 01:24
Bulk replace asset references
/*
* Bulk replace asset references
*/
(async () => {
Dialog.prompt({
title: 'Bulk replace asset references',
content:
'<p>This tool will search for asset references <strong>within your world</strong> that start with the provided value and replace that portion with the other provided value.</p>' +
'<p><label>Find (case sensitive): <input type="text" name="find" placeholder="some/original/path/"></label></p>' +
@xthesaintx
xthesaintx / combinetranscript.py
Last active July 2, 2025 23:56
Merge timestamped .dote json files in chronological order according to "startTime" "endTime" "speakerDesignation" "text" with gui
#!/usr/bin/env python3
import sys
import json
import glob
import re
import os
from datetime import datetime
from collections import defaultdict
from os.path import expanduser, join, basename, isdir, dirname
import tkinter as tk
@xthesaintx
xthesaintx / Notes to Tiles
Created June 13, 2025 21:58
Foundry VTT (tested v12) - covert all map notes to tiles, places the icon used as the tile image and links to the journal on a double click using Monk's Active Tiles
const tileSize = 48;
const tileData= canvas.scene.notes.map(e => {
const entryName = e.entry?.name ?? "";
const entryUuid = e.entry?.uuid ?? "";
return {
width: tileSize,
height: tileSize,
x: e.x - tileSize/2,
y: e.y - tileSize/2,
"texture.src": e.texture.src ?? "icons/svg/book.svg",
@xthesaintx
xthesaintx / wiim.py
Last active April 22, 2023 02:01
Switch Wiim to Line-in
#!/usr/bin/env python3
import requests
import json
#disable the ssl warning as Wiim SSL cert is trash
from urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
#Set vars for the modes to switch to
@xthesaintx
xthesaintx / SpotifyTrackValidate.py
Created December 20, 2022 02:45
Checks the Track ID input from CLI "SpotifyTackValidate.py TRACKID" output VALID or ERROR
#!/usr/bin/env python3
import spotipy
import datetime
import pprint
import os
import sys
# from prompter import prompt, yesno
from spotipy.oauth2 import SpotifyOAuth
# Import the os module
@xthesaintx
xthesaintx / Spotify_Recommendations.py
Last active December 21, 2022 00:41
Creates a spotify playlist based on a track ID
#!/usr/bin/env python3
####
## Replace XXXX with your details
####
import spotipy
import datetime
import pprint
import os
import sys
@xthesaintx
xthesaintx / qbit_completed.py
Created March 22, 2022 01:14
Script that will remove completed torrents that are older than 7 days from the QbitTorrent queue
import qbittorrentapi
import datetime
today = datetime.datetime.now()
#Set age (days) to remove
older = 7
#Converts UTC time to datetime
def utc(x):
dt = datetime.datetime.fromtimestamp(x)
@xthesaintx
xthesaintx / watch.py
Last active March 2, 2022 21:40
Watch Folder - The watched folder feature of qbittorrent on the Pi is pretty flaky and I find I have to keep resetting it. So I wrote my own in Python... It's pretty hacky to get the script to wait for the file to be finished writing (as depending on where the file is copied from 2 to god knows how many events watch_dog will raise on closed), an…
import time
import subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from watchdog.events import PatternMatchingEventHandler
import qbittorrentapi
import os
import logging
import shutil
logging.basicConfig(filename='/home/pi/Scripts/watch.log', filemode='a', format ='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%d-%m-%Y %H:%M:%S' )
@xthesaintx
xthesaintx / AudioSwitcher.py
Last active January 29, 2022 02:36
Python Script that switches through audio output on Mac, can add uid to an ignore list, pops up a notification with output name. USE: I bind the script to a shortcut and add a keyboard shortcut to switch between audio outputs. (Uses https://github.com/deweller/switchaudio-osx)
#!/usr/bin/env python3
import os
import subprocess as sp
import json
def notify(title, text):
os.system("""
osascript -e 'display notification "{}" with title "{}"'
""".format(text, title))
@xthesaintx
xthesaintx / GDriveGrab.py
Last active January 18, 2022 19:38
Headless Raspberry Pi Python script to grab torrent files from a Google Drive Folder and load them into qbittorrent. Uses PyDrive2 GetContentIOBuffer() to aviod downloading a torrent file. Logs the files grabbed into a log file and places that on the GDrive folder as well as locally, also logs the contents (only 1 day old) of a local folder.
#!/usr/bin/env python3
##
## Requires pydrive2, qbittorrent-api and setting up Google API
## client_secrets.json put in the same folder as script
## Must be run on a machine with a browser first to generate mycreds.txt
##
import os
import requests
import filecmp
import shutil