Skip to content

Instantly share code, notes, and snippets.

View exetico's full-sized avatar

Tobias Nordahl Kristensen exetico

View GitHub Profile
@exetico
exetico / github-deployment-cleanup.py
Last active August 12, 2025 08:45
Automated GitHub Deployment Cleanup Script: Reads a JSON file of deployments (or fetch from GitHub), filters by creation date, and deletes old deployments using the GitHub CLI. Includes interactive prompts for fetching, deleting, and file cleanup. Handles encoding issues and guides the user through safe deletion.
# This script reads a JSON file containing deployment data and deletes deployments created before a specific date using the GitHub CLI.
# The jobs was fetched with:
# gh api --method GET -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/<owner>/<repo>/deployments | Out-File -FilePath .\deployments.json
# Remember to adjust the encoding if needed: encoding="utf-16"
import json
import subprocess
import time
import os
threshold_date = "2025-07-25T08:00:00Z" # Will replace with your desired threshold date in ISO 8601 format, e.g., "YYYY-MM-DDTHH:MM:SSZ" like "2025-07-25T08:00:00Z"
@exetico
exetico / send-keycombination-to-multiple-windows-like-obssh
Last active November 13, 2022 11:36
Trigger OBS software to start/stop recordings with one command (Send key-presses to mulitple windows matching the same title)
# I'm using two OBS programs at the same time, to record two sources
# Therefore I need a simple way to start and stop both recordings at the same time
# Most of the time, a shortcut will trigger both windows - but not always
# And... I forget my normal shortcuts on/off
# Therefore I've added "Text Command" widget in KDE, and triggers the following command to start/stop my recording(s)
# You'll need to configure the shorts in OBS, for this to work
# Tested on Manjaro with KDE
# You don't have to do it in a one-liner, btw...
for i in $(xwininfo -root -tree | grep 'OBS '); do if [[ $i =~ ^0x[0-9A-Fa-f]{1,}$ ]]; then xdotool key --window "$i" ctrl+alt+0 ; fi; done
@exetico
exetico / py
Created May 9, 2022 13:42
Python Simple SMTP Tester (Send mail) - Fixed for new SMTP solution where serveraddr needs to be defined in SMTP_SSL() // SMTP() function - Source: https://github.com/turbodog/python-smtp-mail-sending-tester/blob/master/smtptest.py
#!/usr/bin/python
"""smtptest.py: command-line smtp test mail sender
https://github.com/turbodog/python-smtp-mail-sending-tester
Usage: python smtptest.py [options] fromaddress toaddress serveraddress
Examples:
python smtptest.py [email protected] [email protected] mail.example.com
python smtptest.py --debuglevel 1 --usetls -u bob -p xyzzy "Bob <[email protected]>" [email protected] mail.example.com
@exetico
exetico / csv-add-index-and-encode.sh
Last active January 29, 2020 19:26
Bash script, which allows you to add a Index-column to a CSV file, and encode it as UTF-8. You can also add your own seperator. Created, for easy prep of file, before import to Firefly III.
#!/bin/bash
echo ""
if [ -z "${1}" ]; then
echo "csv-add-index-and-encode: Error!"
echo "Please define input-file as the first paramter, and optinally define seperator (like ;) as the secound one, like:"
echo "./csv-fix.sh NemKonto_PosterinterTest3.csv \";\""
echo ""
exit 1
else