Skip to content

Instantly share code, notes, and snippets.

View Antvirf's full-sized avatar
🇫🇮
🇭🇰

Antti Antvirf

🇫🇮
🇭🇰
  • Hong Kong / Finland
  • 14:20 (UTC +08:00)
View GitHub Profile
@Antvirf
Antvirf / slurm_protocol_to_version.txt
Created March 30, 2025 05:09
Slurm protocol number to Slurm version
# See https://github.com/SchedMD/slurm/blob/master/src/common/slurm_protocol_common.h
# for the full list.
# The below is just that list with the values computed out for easier reference
SLURM_25_05_PROTOCOL_VERSION: 43<<8: 11008
SLURM_24_11_PROTOCOL_VERSION: 42<<8: 10752
SLURM_24_05_PROTOCOL_VERSION: 41<<8: 10496
SLURM_23_11_PROTOCOL_VERSION: 40<<8: 10240
SLURM_23_02_PROTOCOL_VERSION: 39<<8: 9984
SLURM_22_05_PROTOCOL_VERSION: 38<<8: 9728
@Antvirf
Antvirf / bash_aliases.sh
Last active March 15, 2025 02:00
Bash Aliases and useful helpers
# Aliases
alias ga="git add"
alias gc="git commit"
alias gca="git commit --amend --no-edit"
alias gd="git diff"
alias gs="git status"
alias gp="git pull"
alias gP="git push"
alias gl="git log"
alias gundo="git reset --soft HEAD~1"
@Antvirf
Antvirf / kubernetes-pod-python-ecoserver.yaml
Created February 4, 2025 14:40
When you need to run an easily-customisable echoserver on Kubernetes
apiVersion: v1
kind: Pod
metadata:
name: test-echoserver
spec:
containers:
- name: main
image: python:latest
ports:
- containerPort: 8080
@Antvirf
Antvirf / fetch-jwt-from-azure.py
Created September 10, 2024 03:58
Get JWT from Azure with Flask
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "flask",
# "requests",
# ]
# ///
# You can execute the entire script using the following command:
# uv run main.py
@Antvirf
Antvirf / migrate-ssm-params.sh
Created August 28, 2024 04:44
Migrate AWS Systems Manager Parameter Store parameters from one AWS account to another
#!/bin/bash
# You must have configured AWS CLI profiles for both source and target, and have authenticated/refreshed the relevant tokens
OLD_AWS_PROFILE=___
NEW_AWS_PROFILE=___
# Stage 1: Get current list of params names and save them to a file
echo "Fetching parameters list..."
aws ssm describe-parameters --page-size 50 --max-items 1000 | jq -r '.Parameters[].Name' > raw_param_names.txt
@Antvirf
Antvirf / ghetto_cron.sh
Last active December 19, 2023 05:31
ghettocron: periodic tasks in a container
ghettocron() {
sleep_duration=$1
echo "[ghettocron] task interval set to $sleep_duration"
while true; do
sleep $sleep_duration
echo "[ghettocron] running task at $(date)"
curl http://localhost:8000/do_thing/ > /dev/null
done
}