Skip to content

Instantly share code, notes, and snippets.

View Alistair1231's full-sized avatar

Alistair1231 Alistair1231

View GitHub Profile
@Alistair1231
Alistair1231 / Dockerfile
Last active February 7, 2025 22:31
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 && \
@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 / 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 && \
@0atman
0atman / configuration.nix
Last active February 17, 2025 00:56
A rebuild script that commits on a successful build
{
config,
pkgs,
options,
...
}: let
hostname = "oatman-pc"; # to alllow per-machine config
in {
networking.hostName = hostname;
@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
@Alistair1231
Alistair1231 / get-latest-file.sh
Last active April 22, 2023 10:51
get latest github release using curl on bash (ex. revanced-cli)
# ########
# # bash #
# ########
# pattern="ATLauncher-.*"
# repo="Alistair1231/ATLauncher-Offline"
# # remove old files
# rm -f description.txt && rm -f ATLauncher-*.jar
# # get the files
# curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -oP '"browser_download_url":\s*"\K[^"]+' | grep -E "$pattern" | wget -q --show-progress -i -
@Alistair1231
Alistair1231 / Playnite-Run-And-Close-Program.adoc
Last active March 26, 2023 22:28
Playnite-Run-And-Close-Program

"Normal" App

execute before starting a game
$file1 = Start-Process "python3" "D:\path\file1.py" -Passthru
$file1 | Export-Clixml -Path (Join-Path D:\path 'file1-handle.xml')
@Alistair1231
Alistair1231 / tikz-uml.md
Last active March 17, 2023 10:40 — forked from zorgick/tikz-uml.md
How to install tikz-uml package on different platforms
@Alistair1231
Alistair1231 / ssh-copy-id.ps1
Last active September 6, 2023 17:57
ssh-copy-id windows
# just copy/paste into powershell and edit variables before pressing enter.
$user="user"; `
$server="example.com"; `
$port=22; `
$file="id_rsa"; `
type $env:USERPROFILE\.ssh\$file.pub | ssh $user@$server -p $port "mkdir -p ~/.ssh && cat >> .ssh/authorized_keys"