import time
import random
class RandomIntervalTrigger:
def __init__(self, base, diff):
self.base = base
self.diff = diff
self.next_time = time.time() + random.uniform(base, base + diff)
def check(self):
"""Return True once every random(base..base+diff)...
Ax cooldown
public class Cooldown {
private final long cd;
private long last = 0;
public Cooldown(int minutes) {
this.cd = minutes * 60_000L;
}
public boolean check() {
long now = System.currentTimeMillis();
boolean ready = now - last >= cd...
LLM optimized
def snip_llm(text: str, n: int, *strip_chars: str) -> str:
"""
Trim text to <= n characters without cutting words.
- Removes leading characters in strip_chars (varargs).
- Appends ' nyaa' if snipped.
"""
# Build a single string of chars to strip
if...
def snip_at_word_boundary(text: str, n: int) -> str:
"""
Return a version of `text` trimmed to <= n characters
without cutting a word in the middle.
"""
if len(text) <= n:
return text
# Cut at the limit first
snippet = text[:n]
# If the next character is...