Skip to content

Instantly share code, notes, and snippets.

View Alistair1231's full-sized avatar

Alistair1231 Alistair1231

View GitHub Profile
@Alistair1231
Alistair1231 / podcast-dlgen.py
Last active January 25, 2025 15:56
podcast-dlgen.py - Easily download podcasts with names from a RSS feed and jdownloader
#!/usr/bin/env python3
# /// script
# dependencies = [
# "requests>=2.31.0",
# "lxml>=4.9.4",
# "pyperclip>=1.8.2",
# ]
# ///
# Inspired by https://maxbarrass.com/blog/2020/04/10/downloading-files-from-rss-with-jdownloader-packegizer%F0%9F%92%BB%F0%9F%92%A5%F0%9F%98%8D
# archive link: https://archive.is/rP7Qg
@Alistair1231
Alistair1231 / vscode-ssh.sh
Last active January 22, 2025 20:22
vscode remote from cli
# code --folder-uri "vscode-remote://ssh-remote+HOSTNAME/path/to/folder"
# code --file-uri "vscode-remote://ssh-remote+HOSTNAME/path/to/workspace.code-workspace"
# e.g.
code --folder-uri "vscode-remote://ssh-remote+nas/mnt/storage/apps"
@Alistair1231
Alistair1231 / save-me-as-bookmark
Created January 14, 2025 18:29
amazon hide entries <4.5 Stars
javascript:(function()%7Bfunction%20findByText(text)%20%7B%0A%20%20let%20entries%20%3D%20new%20Set()%0A%0A%20%20this.forEach((element)%20%3D%3E%20%7B%0A%20%20%20%20if%20(textMatches(element.innerHTML%2C%20text))%20%7B%0A%20%20%20%20%20%20entries.add(element)%0A%20%20%20%20%7D%0A%20%20%7D)%0A%0A%20%20return%20Array.from(entries)%0A%0A%20%20function%20textMatches(content%2C%20searchText)%20%7B%0A%20%20%20%20return%20searchText%20instanceof%20RegExp%0A%20%20%20%20%20%20%3F%20searchText.test(content)%0A%20%20%20%20%20%20%3A%20content.includes(searchText)%0A%20%20%7D%0A%7D%0A%0AObject.defineProperty(Array.prototype%2C%20'findByText'%2C%20%7B%0A%20%20enumerable%3A%20false%2C%0A%20%20writable%3A%20true%2C%0A%20%20value%3A%20findByText%2C%0A%7D)%0AObject.defineProperty(NodeList.prototype%2C%20'findByText'%2C%20%7B%0A%20%20enumerable%3A%20false%2C%0A%20%20writable%3A%20true%2C%0A%20%20value%3A%20findByText%2C%0A%7D)%0A%2F%2F%3F%20%5E%20---%20Find%20by%20text%20---%20%5E%0A%0Aconst%20items%20%3D%20document.querySelecto
@Alistair1231
Alistair1231 / archlinux-cpr.sh
Last active February 7, 2025 22:21
arch linux revive pacman on old installs
# This one-liner revives an old Arch Linux install where `pacman -Syu` is not working by:
# 1. Updating mirror list for DE, AT, CH sorted by rate - ensures access to active and fast mirrors.
# 2. Downloading and running static pacman, initializing and populating pacman keyring - re-establishes basic package management capabilities.
# 3. Updating archlinux-keyring and pacman-contrib - ensures keyring and essential tools are up-to-date.
# 4. Reranking mirror list with the top 5 fastest servers - this is why we needed pacman-contrib.
# 5. Running `sudo pacman -Syu --noconfirm` - brings the system to the latest package versions.
curl -s "https://archlinux.org/mirrorlist/?country=DE&country=AT&country=CH&protocol=https&use_mirror_status=on&sort=rate" | sed -e 's/^#Server/Server/' -e '/^#/d' | sudo tee /etc/pacman.d/mirrorlist && \
curl -L https://pkgbuild.com/~morganamilo/pacman-static/x86_64/bin/pacman-static -o /tmp/pacman-static && \
chmod +x /tmp/pacman-static && \
sudo pacman-key --init && \
@Alistair1231
Alistair1231 / Youtube on TV.bat
Created October 21, 2024 17:14
Youtube on TV PWA
C:\Users\alist\scoop\shims\brave.exe --kiosk --enable-extensions --user-agent="Mozilla/5.0 (PS4; Leanback Shell) Gecko/20100101 Firefox/65.0 LeanbackShell/01.00.01.75 Sony PS4/ (PS4, , no, CH)" "https://www.youtube.com/tv#/?env_forceFullAnimation=true"
@Alistair1231
Alistair1231 / run_backup.sh
Last active October 10, 2024 07:06
restic backup script for docker bind mounts
#!/bin/bash
# to add this as a cronjob that runs every day at 4:00, run `crontab -e` and add the following line:
# 0 4 * * * /srv/restic/run_backup.sh
RESTIC_PATH="/home/al/.nix-profile/bin/restic"
SCRIPT_DIR="/srv/restic"
LOG_FILE="$SCRIPT_DIR/logs/backup_$(date +%Y%m%d_%H%M%S).log"
ENV_FILE="restic.env"
@Alistair1231
Alistair1231 / scrcpy.sh
Last active July 5, 2024 12:28
twitch scrcpy script
DEVICE=$(adb devices | sed -n '2 p' | cut -f 1)
# set window title
echo -en "\033]0;SCRCPY\007"
adb -s $DEVICE shell wm size 1080x1920
# stop twitch from avoiding cutout
adb -s $DEVICE shell cmd overlay enable com.android.internal.display.cutout.emulation.noCutout
adb -s $DEVICE shell cmd overlay enable com.android.internal.display.cutout.emulation.corner
# if device is ip then use 2M bitrate and 200 buffer
if [[ $DEVICE == *:* ]];then
@Alistair1231
Alistair1231 / whatLevel.ipynb
Created June 15, 2024 20:03
Minecraft, JustEnoughResources / Region Scanner: Parse world-gen file and draw graph of where to find ores
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Alistair1231
Alistair1231 / _moonlight-setup.adoc
Last active November 18, 2025 17:04
Headless Moonlight Streaming PC
:doctype: book
:toc: left
:toclevels: 3
:data-uri:
:icons: font
:source-highlighter: rouge
:source-linenums-option: inline
:icons: font
@Alistair1231
Alistair1231 / crop.ps1
Last active February 22, 2024 16:26
crop video to 16:9 with powershell and ffmpeg
# Check if an argument is provided
if ($args.Count -eq 0) {
Write-Host "No video file provided. Usage: .\script.ps1 [video file]"
exit
}
# Assign the first argument as the input file
$inputFile = $args[0]
# Check if the file exists