Skip to content

Instantly share code, notes, and snippets.

View Alistair1231's full-sized avatar

Alistair1231 Alistair1231

View GitHub Profile
@Alistair1231
Alistair1231 / nginx.conf
Last active July 25, 2025 06:12
Nginx Proxy Manager Basic Auth for XHR/Ajax "Custom Nginx Configuration"
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header Authorization $http_authorization;
proxy_pass http://$server:$port;
}
@Alistair1231
Alistair1231 / Dockerfile
Last active April 3, 2025 18:55
arch linux distrobox with systemd
FROM archlinux:latest
ARG USER
# make sure pacman works, also install basic packages: sudo, dbus, systemd
RUN 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' | 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 && pacman-key --init && pacman-key --populate archlinux && \
/tmp/pacman-static -Sy archlinux-keyring pacman-contrib sudo dbus systemd --noconfirm && \
curl -s "https://archlinux.org/mirrorlist/?country=DE&country=AT&country=CH&protocol=https&use_mirror_status=on" | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -n 5 - | tee /etc/pacman.d/mirrorlist && \
pacman -Syu --noconfirm
@Alistair1231
Alistair1231 / Dockerfile
Last active January 28, 2025 12:53
latexrun customizations
# for new image tags check: https://gitlab.com/islandoftex/images/texlive/container_registry/573747
FROM registry.gitlab.com/islandoftex/images/texlive:TL2024-2025-01-26-full-doc
# create a non-root user
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN apt-get update && \
apt-get install -y man sudo openssh-client neovim inkscape zsh tmux && \

Table comparison

image

Tabularray

tabularray
% \usepackage{color}
@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"