Skip to content

Instantly share code, notes, and snippets.

View choutianxius's full-sized avatar
🎯
Overengineering

Tianxiu (Tyson) Zhou choutianxius

🎯
Overengineering
View GitHub Profile
@choutianxius
choutianxius / pyclean.sh
Last active March 1, 2025 17:12
Simple `pyclean` on MacOS
#!/bin/zsh
function usage() {
cat << END
pyclean (custom shell script impl)
Description:
Recursively finds and deletes Python bytecode files (*.pyc, *.pyo) and
__pycache__ directories within the specified directories.
Param(
[Parameter(Mandatory, Position = 0, HelpMessage = "Path to save PNG file")] [string] $SavePath
)
if (-not [System.IO.Directory]::Exists([System.IO.Path]::GetDirectoryName($SavePath))) {
Throw "Save directory doesn't exist."
}
@choutianxius
choutianxius / sliding_window_divisible.py
Last active January 18, 2025 17:12
Sliding Window Divisible
from collections import deque
class SlidingWindowDivisible:
"""
Test whether the product of a sliding window is divisible by a given number
"""
def __init__(self, k: int):
self.k = k
self.queue = deque()
'''
A simple in-memory banking system which supports:
- Create accounts
- Deposit money
- Transfer money from one account to another
- Make payments, which adds 2% cashback after one day
- Get payment status at current timestamp
- Get balance at certain timestamp
- Merge accounts
- Get the most active accounts in terms of spending money