Skip to content

Instantly share code, notes, and snippets.

View s4lt3d's full-sized avatar

Walter Gordy s4lt3d

View GitHub Profile
@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
class Recorder:
def __init__(self):
self.recording = False
self.actions = []
self.start_time = None
self.playback_thread = None
using UnityEngine;
[RequireComponent(typeof(Collider))]
public class SnapToGround2 : MonoBehaviour
{
public GameObject objectToSpawn;
public float timeToSpawn = 0.1f;
void SnapRotatedObjectToGround()
{
# Types out code for videos designed for use in Rider
import pyperclip
import pyautogui
import time
def type_clipboard_content():
# Get text from clipboard
text = pyperclip.paste()
text = text.replace("\n}", "}")
# 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: