Skip to content

Instantly share code, notes, and snippets.

View choutianxius's full-sized avatar
🎯
Overengineering

Tianxiu (Tyson) Zhou choutianxius

🎯
Overengineering
View GitHub Profile
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.InputStreamReader;
import java.io.FileInputStream;
import javax.net.ssl.KeyManagerFactory;
@choutianxius
choutianxius / pyclean.ps1
Last active April 30, 2025 13:50
Simple `pyclean` on Win/MacOS
function Show-Usage {
@"
pyclean (custom PowerShell script impl)
Description:
Recursively finds and deletes Python bytecode files (*.pyc, *.pyo) and
__pycache__ and .ipynb_checkpoints directories within the specified directories.
Usage:
pyclean [directories...]
[directories ...] One or more directories where the cleanup should be performed.
Example:
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