This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
"""Manage mods for an Arma 3 server.""" | |
# /// script | |
# dependencies = [] | |
# requires-python = ">=3.11" | |
# /// | |
from __future__ import annotations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HACK: this proof of concept is not robust, don't use this in production! | |
# Minimum Python version: 3.11 | |
import asyncio | |
from contextvars import Context | |
from typing import ( | |
Any, | |
Callable, | |
Coroutine, | |
Generator, | |
Generic, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import operator | |
import random | |
import sys | |
from abc import ABC, abstractmethod | |
from dataclasses import dataclass | |
from enum import Enum | |
from tkinter import Misc, StringVar, Tk, Toplevel | |
from tkinter.simpledialog import askstring | |
from tkinter.ttk import Button, Entry, Frame, Label, Radiobutton |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contextlib | |
from tkinter import IntVar, TclError, Text, Tk | |
from tkinter.ttk import Entry, Frame | |
app = Tk() | |
app.title("Resizable Text") | |
app.geometry("500x300") | |
app.grid_columnconfigure(0, weight=1) | |
app.grid_rowconfigure(0, weight=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import signal | |
import sys | |
from argparse import ArgumentParser | |
from pathlib import Path | |
from subprocess import Popen, TimeoutExpired | |
if sys.platform == "win32": | |
sys.exit("SIGINT and SIGTERM are not supported on Windows.") | |
# 1. Determine which signal to use |
NewerOlder