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
| """ | |
| 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 |
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/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 |
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 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 |
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
| using UnityEngine; | |
| [RequireComponent(typeof(Collider))] | |
| public class SnapToGround2 : MonoBehaviour | |
| { | |
| public GameObject objectToSpawn; | |
| public float timeToSpawn = 0.1f; | |
| void SnapRotatedObjectToGround() | |
| { |
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
| # 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}", "}") |
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
| # 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) |
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
| # 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: |