chrisjacksonn/interview-sim / skills/sim
sim
VerifiedRun a timed coding assessment simulation in the terminal. Use for OA practice, GCA or ICA mocks, mock interviews, pairing rounds, take-homes, and pasted job postings.
questions/gca/request-budget/mutants/shared_budget.py
View on GitHub"""Deliberately wrong: one budget for every client instead of one each
Used by tools/qa.py to prove the hidden suite can tell this from correct.
"""
from collections import deque
class RateLimiter:
def __init__(self, limit, window):
if not isinstance(limit, int) or isinstance(limit, bool) or limit < 1:
raise ValueError("limit must be an integer of at least 1")
if window <= 0:
raise ValueError("window must be positive")
self.limit = limit
self.window = window
self._seen = {}
def _live(self, key, at):
"""The client's still-counting timestamps, expired ones dropped."""
events = self._seen.get(key)
if events is None:
return None
cutoff = at - self.window
while events and events[0] <= cutoff:
events.popleft()
return events
def allow(self, key, at):
if not isinstance(key, str) or not key:
return False
events = self._live("", at)
if events is None:
events = deque()
self._seen[""] = events
if len(events) >= self.limit:
return False
events.append(at)
return True
def count(self, key, at):
if not isinstance(key, str) or not key:
return 0
events = self._live(key, at)
return len(events) if events else 0
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |