Skip to content

Instantly share code, notes, and snippets.

View thegamecracks's full-sized avatar

thegamecracks thegamecracks

View GitHub Profile
@thegamecracks
thegamecracks / ziplab.py
Created January 15, 2026 14:07
Create a .zip archive of a .NET solution directory with build artifacts omitted
"""Create a .zip archive of a .NET solution directory with build artifacts omitted.
If the solution directory is tracked in a Git repository that has a .gitignore to
exclude .NET build artifacts, consider `git archive <branch> -o <filename>` instead.
"""
import argparse
import fnmatch
import hashlib
@thegamecracks
thegamecracks / newsln.py
Created January 15, 2026 13:58
Generate a .NET solution with one or more projects, in case I forget how to use dotnet
"""Generate a .NET solution with one or more projects."""
import argparse
import subprocess
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Self
@thegamecracks
thegamecracks / video_bitrate.pyw
Created January 15, 2026 13:52
Calculate video bitrate to achieve a given filesize and duration
"""Calculate the video bitrate for video compression software
to achieve a given filesize and duration.
Intended for use with HandBrake: https://handbrake.fr/
Result bitrate should be copied to your constant/average bitrate.
Note that input filesize is in megabytes, not mebibytes.
"""
import re
@thegamecracks
thegamecracks / sum_modpack.py
Last active January 12, 2026 18:12
Produce filesize statistics from a list of workshop mods
#!/usr/bin/python3
"""Produce filesize statistics from a list of workshop mods."""
# /// script
# dependencies = []
# requires-python = ">=3.11"
# ///
from __future__ import annotations
@thegamecracks
thegamecracks / tgm.py
Last active January 3, 2026 22:55
A zero-dependency, single-file workshop mod manager CLI for Arma 3
#!/usr/bin/python3
"""Manage workshop mods for an Arma 3 server.
See ${prog} help for more information.
"""
# /// script
# dependencies = []
# requires-python = ">=3.11"
@thegamecracks
thegamecracks / backup_world.py
Last active July 31, 2025 20:52
Yet another script to backup Minecraft worlds
#!/usr/bin/python3
"""Backup a Minecraft world into an archive.
CAUTION: This script has not been thoroughly tested and you may encounter bugs.
By default, this script will perform the following tasks:
1. Download mcrcon from https://github.com/Tiiffi/mcrcon, if needed
2. Send an RCON command to disable automatic saving and save the world
3. Create an archive of the world/ directory named "world-%Y-%m-%d.zip"
4. Send an RCON command to re-enable automatic saving
@thegamecracks
thegamecracks / notch.sqf
Last active May 19, 2025 01:45
A proof-of-concept approximation of missile notching in Arma 3
TGC_fnc_getAbsClosureSpeed = {
params ["_observer", "_target"];
private _dir = getPosATL _target vectorFromTo getPosATL _observer;
private _velocity = velocity _target;
private _angle = vectorNormalized _velocity vectorDotProduct _dir;
vectorMagnitude (_velocity vectorMultiply _angle)
};
TGC_fnc_isRadarGuided = {
params ["_ammo"];
private _property = configFile >> "CfgAmmo" >> _ammo >> "weaponLockSystem";
@thegamecracks
thegamecracks / resolve_case.py
Last active February 8, 2025 03:58
Structuring multiple prompts with discord.py message components
import datetime
import discord
from discord import app_commands
from discord.ext import commands
bot = commands.Bot(".", intents=discord.Intents.default())
@bot.command()
@commands.is_owner()
import datetime
import textwrap
from tkinter import BooleanVar, Tk
from tkinter.ttk import Checkbutton, Frame, Label, Style
LOREM_IPSUM = "Lorem ipsum odor amet, consectetuer adipiscing elit. Vivamus tincidunt ultricies accumsan feugiat ultrices sagittis tellus? Turpis penatibus convallis; suscipit nisl tincidunt suscipit litora? Ex fusce facilisis ullamcorper aenean iaculis metus pharetra libero. Feugiat fermentum fermentum mauris urna curabitur diam ad. Volutpat parturient arcu nec semper etiam vitae augue convallis dui. Gravida neque lacus donec interdum finibus ullamcorper. Sodales aliquam tempor tempor purus curabitur mauris ridiculus aptent."
class TaskCard(Frame):
MAX_DESCRIPTION_CHARS = 256
@thegamecracks
thegamecracks / table.py
Created January 8, 2025 02:36
A basic Tkinter table widget using frames, labels, and native relief styles
from tkinter import Tk
from tkinter.ttk import Frame, Label, Style
class Table(Frame):
"""Presents tabular data in a self-contained widget."""
def __init__(self, parent, rows, *, title):
super().__init__(parent)