Skip to content

Instantly share code, notes, and snippets.

View s4lt3d's full-sized avatar

Walter Gordy s4lt3d

View GitHub Profile
#!/usr/bin/env bash
set -e
echo "=== Syncthing on SteamOS background setup (distrobox) ==="
# -----------------------------
# CONFIG
# -----------------------------
BOX_NAME="syncthing-box"
@s4lt3d
s4lt3d / minmaxcardgame.py
Created June 27, 2025 15:36
Two player card game min max algorithm
"""
Two player card game min max
Run with smaller parameters as it already runs a very long time in python
"""
import random
from dataclasses import dataclass
from collections import Counter, defaultdict
from itertools import combinations
from functools import lru_cache
#!/usr/bin/env python3
"""
Generate a bi-weekly payroll calendar.
Rules
• “Last working day” is the final business day (Mon–Fri, not a holiday)
of each 14-day period.
• Pay date = exactly three business days before that last working day.
Run
from pynput import mouse, keyboard
import threading
import time
import json
from pathlib import Path
from datetime import datetime
DEFAULT_RECORDING_FILE = "input_recording"
using UnityEngine;
[RequireComponent(typeof(Collider))]
public class SnapToGround2 : MonoBehaviour
{
public GameObject objectToSpawn;
public float timeToSpawn = 0.1f;
void SnapRotatedObjectToGround()
{
@s4lt3d
s4lt3d / RiderTyper
Last active December 24, 2025 19:14
Fixes semicolon issues };
import pyperclip
import pyautogui
import time
def type_clipboard_content():
text = pyperclip.paste()
text = text.replace("\n}", "}")
segments = text.split('}')
# Helps visualize tough projection problems in python
# euler_to_quaternion
# quaternion_from_angle_axis
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def euler_to_quaternion(roll, pitch, yaw):
roll = np.radians(roll)
# Random shuffle which accounts for non-repeating elements after looping shuffles
# Useful for games which do random actions but you never want to see the same action twice in a row
import random
def knuth_shuffle(a, prev_end):
for i in range(len(a)-1,1, -1):
j = random.randint(0, i)
a[i], a[j] = a[j], a[i]
if a[0] == prev_end: