Skip to content

chrisjacksonn/interview-sim / skills/sim

Run 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.

FileKindSize
SKILL.mdskill md21.7 KB
questions/gca/batch-split/meta.jsonconfig265 B
questions/gca/batch-split/mutants/average_target.pyscript131 B
questions/gca/batch-split/mutants/even_chunks.pyscript194 B
questions/gca/batch-split/mutants/exhaustive.pyscript546 B
questions/gca/batch-split/mutants/low_starts_at_zero.pyscript359 B
questions/gca/batch-split/mutants/requires_exact_group_count.pyscript388 B
questions/gca/batch-split/mutants/sorts_first.pyscript388 B
questions/gca/batch-split/mutants/strict_greedy_off_by_one.pyscript389 B
questions/gca/batch-split/problem.mdmarkdown991 B
questions/gca/batch-split/reference.pyscript1.1 KB
questions/gca/batch-split/starter.pyscript473 B
questions/gca/batch-split/tests_hidden.pyscript4.2 KB
questions/gca/batch-split/tests_public.pyscript544 B
questions/gca/bracket-check/meta.jsonconfig249 B
questions/gca/bracket-check/mutants/angle_brackets_count.pyscript283 B
questions/gca/bracket-check/mutants/counts_only.pyscript143 B
questions/gca/bracket-check/mutants/empty_stack_pop.pyscript270 B
questions/gca/bracket-check/mutants/forgets_leftovers.pyscript268 B
questions/gca/bracket-check/mutants/ignores_kind.pyscript241 B
questions/gca/bracket-check/mutants/leftover_openers_pass_patch.pyscript190 B
questions/gca/bracket-check/mutants/recursive.pyscript446 B
questions/gca/bracket-check/mutants/returns_truthy_not_bool.pyscript286 B
questions/gca/bracket-check/problem.mdmarkdown700 B
questions/gca/bracket-check/reference.pyscript410 B
questions/gca/bracket-check/starter.pyscript344 B
questions/gca/bracket-check/tests_hidden.pyscript3.0 KB
questions/gca/bracket-check/tests_public.pyscript620 B
questions/gca/build-order/meta.jsonconfig273 B
questions/gca/build-order/mutants/duplicate_blocks_forever.pyscript814 B
questions/gca/build-order/mutants/no_tiebreak.pyscript589 B
questions/gca/build-order/mutants/partial_on_cycle.pyscript606 B
questions/gca/build-order/mutants/pre_sorted_not_dynamic.pyscript612 B
questions/gca/build-order/mutants/recursive_dfs.pyscript672 B
questions/gca/build-order/mutants/unknown_tasks_counted.pyscript662 B
questions/gca/build-order/problem.mdmarkdown1.4 KB
questions/gca/build-order/reference.pyscript1.1 KB
questions/gca/build-order/starter.pyscript605 B
questions/gca/build-order/tests_hidden.pyscript5.1 KB
questions/gca/build-order/tests_public.pyscript817 B
questions/gca/checkout-rules/meta.jsonconfig504 B
questions/gca/checkout-rules/mutants/accepts_a_free_deal.pyscript1.5 KB
questions/gca/checkout-rules/mutants/accepts_deal_quantity_one.pyscript1.5 KB
questions/gca/checkout-rules/mutants/bad_price_still_stored.pyscript1.5 KB
questions/gca/checkout-rules/mutants/clear_wipes_everything.pyscript1.6 KB
questions/gca/checkout-rules/mutants/deal_applies_once.pyscript1.6 KB
questions/gca/checkout-rules/mutants/leftover_at_deal_price.pyscript1.5 KB
questions/gca/checkout-rules/mutants/leftover_dropped.pyscript1.5 KB
questions/gca/checkout-rules/mutants/price_snapshot_at_scan.pyscript1.6 KB
questions/gca/checkout-rules/problem.mdmarkdown2.6 KB
questions/gca/checkout-rules/reference.pyscript1.6 KB
questions/gca/checkout-rules/starter.pyscript826 B
questions/gca/checkout-rules/tests_hidden.pyscript8.3 KB
questions/gca/checkout-rules/tests_public.pyscript879 B
questions/gca/dup-window/meta.jsonconfig290 B
questions/gca/dup-window/mutants/abs_window.pyscript692 B
questions/gca/dup-window/mutants/case_insensitive.pyscript672 B
questions/gca/dup-window/mutants/dedupes_stamps.pyscript716 B
questions/gca/dup-window/mutants/exclusive_window.pyscript669 B
questions/gca/dup-window/mutants/mutates_input.pyscript703 B
questions/gca/dup-window/mutants/spread_not_gap.pyscript630 B
questions/gca/dup-window/mutants/unsorted_output.pyscript655 B
questions/gca/dup-window/mutants/unsorted_stamps.pyscript674 B
questions/gca/dup-window/problem.mdmarkdown1.0 KB
questions/gca/dup-window/reference.pyscript538 B
questions/gca/dup-window/starter.pyscript430 B
questions/gca/dup-window/tests_hidden.pyscript3.2 KB
questions/gca/dup-window/tests_public.pyscript666 B
questions/gca/floor-robot/meta.jsonconfig523 B
questions/gca/floor-robot/mutants/back_goes_forward.pyscript2.1 KB
questions/gca/floor-robot/mutants/east_wall_off_by_one.pyscript2.2 KB
questions/gca/floor-robot/mutants/floor_wraps.pyscript2.1 KB
questions/gca/floor-robot/mutants/place_ignores_racking.pyscript2.1 KB
questions/gca/floor-robot/mutants/racking_ignored_when_moving.pyscript2.1 KB
questions/gca/floor-robot/mutants/refusal_stops_the_run.pyscript2.2 KB
questions/gca/floor-robot/mutants/turns_are_swapped.pyscript2.1 KB
questions/gca/floor-robot/mutants/unknown_commands_ignored.pyscript2.1 KB
questions/gca/floor-robot/problem.mdmarkdown2.3 KB
questions/gca/floor-robot/reference.pyscript2.2 KB
questions/gca/floor-robot/starter.pyscript693 B
questions/gca/floor-robot/tests_hidden.pyscript7.4 KB
questions/gca/floor-robot/tests_public.pyscript717 B
questions/gca/log-window/meta.jsonconfig255 B
questions/gca/log-window/mutants/forgets_first_window.pyscript246 B
questions/gca/log-window/mutants/no_width_guard.pyscript225 B
questions/gca/log-window/mutants/off_by_one_range.pyscript250 B
questions/gca/log-window/mutants/quadratic.pyscript152 B
questions/gca/log-window/mutants/returns_average.pyscript257 B
questions/gca/log-window/mutants/wrong_subtract_index.pyscript250 B
questions/gca/log-window/problem.mdmarkdown735 B
questions/gca/log-window/reference.pyscript491 B
questions/gca/log-window/starter.pyscript418 B
questions/gca/log-window/tests_hidden.pyscript2.6 KB
questions/gca/log-window/tests_public.pyscript560 B
questions/gca/merge-feeds/meta.jsonconfig255 B
questions/gca/merge-feeds/mutants/advances_wrong_feed.pyscript437 B
questions/gca/merge-feeds/mutants/dedupes.pyscript127 B
questions/gca/merge-feeds/mutants/forgets_empty_feeds.pyscript336 B
questions/gca/merge-feeds/mutants/mutates_input.pyscript324 B
questions/gca/merge-feeds/mutants/negative_limit_slice.pyscript398 B
questions/gca/merge-feeds/mutants/never_advances.pyscript379 B
questions/gca/merge-feeds/mutants/only_first_feed.pyscript101 B
questions/gca/merge-feeds/mutants/sorts_the_input.pyscript989 B
questions/gca/merge-feeds/mutants/unsorted_output.pyscript168 B
questions/gca/merge-feeds/problem.mdmarkdown1011 B
questions/gca/merge-feeds/reference.pyscript971 B
questions/gca/merge-feeds/starter.pyscript439 B
questions/gca/merge-feeds/tests_hidden.pyscript4.3 KB
questions/gca/merge-feeds/tests_public.pyscript683 B
questions/gca/pack-combinations/meta.jsonconfig286 B
questions/gca/pack-combinations/mutants/assigns_instead_of_adds.pyscript341 B
questions/gca/pack-combinations/mutants/counts_permutations.pyscript344 B
questions/gca/pack-combinations/mutants/descending_inner_loop.pyscript337 B
questions/gca/pack-combinations/mutants/duplicates_multiply.pyscript267 B
questions/gca/pack-combinations/mutants/exponential.pyscript400 B
questions/gca/pack-combinations/mutants/modulo.pyscript311 B
questions/gca/pack-combinations/mutants/off_by_one_range.pyscript345 B
questions/gca/pack-combinations/mutants/zero_target_is_zero.pyscript301 B
questions/gca/pack-combinations/problem.mdmarkdown1000 B
questions/gca/pack-combinations/reference.pyscript738 B
questions/gca/pack-combinations/starter.pyscript495 B
questions/gca/pack-combinations/tests_hidden.pyscript3.8 KB
questions/gca/pack-combinations/tests_public.pyscript628 B
questions/gca/request-budget/meta.jsonconfig558 B
questions/gca/request-budget/mutants/closed_boundary.pyscript1.4 KB
questions/gca/request-budget/mutants/count_never_expires.pyscript1.4 KB
questions/gca/request-budget/mutants/counts_refusals.pyscript1.4 KB
questions/gca/request-budget/mutants/empty_key_allowed.pyscript1.3 KB
questions/gca/request-budget/mutants/no_expiry_on_allow.pyscript1.3 KB
questions/gca/request-budget/mutants/no_validation.pyscript1.2 KB
questions/gca/request-budget/mutants/off_by_one_limit.pyscript1.4 KB
questions/gca/request-budget/mutants/shared_budget.pyscript1.4 KB
questions/gca/request-budget/problem.mdmarkdown2.4 KB
questions/gca/request-budget/reference.pyscript1.6 KB
questions/gca/request-budget/starter.pyscript601 B
questions/gca/request-budget/tests_hidden.pyscript8.1 KB
questions/gca/request-budget/tests_public.pyscript1.1 KB
questions/gca/room-schedule/meta.jsonconfig266 B
questions/gca/room-schedule/mutants/assumes_sorted.pyscript207 B
questions/gca/room-schedule/mutants/closed_intervals.pyscript251 B
questions/gca/room-schedule/mutants/counts_total_meetings.pyscript71 B
questions/gca/room-schedule/mutants/final_not_peak.pyscript226 B
questions/gca/room-schedule/mutants/keeps_degenerate.pyscript196 B
questions/gca/room-schedule/mutants/quadratic_pairwise.pyscript205 B
questions/gca/room-schedule/problem.mdmarkdown860 B
questions/gca/room-schedule/reference.pyscript721 B
questions/gca/room-schedule/starter.pyscript408 B
questions/gca/room-schedule/tests_hidden.pyscript3.5 KB
questions/gca/room-schedule/tests_public.pyscript585 B
questions/gca/route-fuel/meta.jsonconfig294 B
questions/gca/route-fuel/mutants/bool_when_no_stops.pyscript739 B
questions/gca/route-fuel/mutants/first_not_largest.pyscript526 B
questions/gca/route-fuel/mutants/no_sort.pyscript637 B
questions/gca/route-fuel/mutants/off_by_one_stops.pyscript652 B
questions/gca/route-fuel/mutants/returns_stops_when_stuck.pyscript652 B
questions/gca/route-fuel/mutants/smallest_depot.pyscript670 B
questions/gca/route-fuel/mutants/sorts_in_place.pyscript590 B
questions/gca/route-fuel/mutants/strictly_less_reachable.pyscript644 B
questions/gca/route-fuel/problem.mdmarkdown1.1 KB
questions/gca/route-fuel/reference.pyscript850 B
questions/gca/route-fuel/starter.pyscript480 B
questions/gca/route-fuel/tests_hidden.pyscript3.2 KB
questions/gca/route-fuel/tests_public.pyscript600 B
questions/gca/run-compression/meta.jsonconfig252 B
questions/gca/run-compression/mutants/always_compresses.pyscript292 B
questions/gca/run-compression/mutants/case_insensitive.pyscript329 B
questions/gca/run-compression/mutants/compresses_twos.pyscript313 B
questions/gca/run-compression/mutants/counts_total_not_run.pyscript334 B
questions/gca/run-compression/mutants/drops_final_run.pyscript267 B
questions/gca/run-compression/mutants/threshold_four.pyscript313 B
questions/gca/run-compression/problem.mdmarkdown901 B
questions/gca/run-compression/reference.pyscript632 B
questions/gca/run-compression/starter.pyscript343 B
questions/gca/run-compression/tests_hidden.pyscript3.0 KB
questions/gca/run-compression/tests_public.pyscript648 B
questions/gca/sensor-gaps/meta.jsonconfig263 B
questions/gca/sensor-gaps/mutants/dedupes.pyscript289 B
questions/gca/sensor-gaps/mutants/first_gap.pyscript249 B
questions/gca/sensor-gaps/mutants/includes_singletons.pyscript282 B
questions/gca/sensor-gaps/mutants/no_grouping.pyscript207 B
questions/gca/sensor-gaps/mutants/span_not_gap.pyscript235 B
questions/gca/sensor-gaps/mutants/takes_min.pyscript283 B
questions/gca/sensor-gaps/mutants/unsorted.pyscript265 B
questions/gca/sensor-gaps/problem.mdmarkdown1.2 KB
questions/gca/sensor-gaps/reference.pyscript582 B
questions/gca/sensor-gaps/starter.pyscript418 B
questions/gca/sensor-gaps/tests_hidden.pyscript3.5 KB
questions/gca/sensor-gaps/tests_public.pyscript748 B
questions/gca/sensor-median/meta.jsonconfig306 B
questions/gca/sensor-median/mutants/int_division_even.pyscript774 B
questions/gca/sensor-median/mutants/lower_of_the_two.pyscript746 B
questions/gca/sensor-median/mutants/middle_off_by_one.pyscript751 B
questions/gca/sensor-median/mutants/mutates_input.pyscript625 B
questions/gca/sensor-median/mutants/no_width_guard.pyscript817 B
questions/gca/sensor-median/mutants/odd_returns_int.pyscript766 B
questions/gca/sensor-median/mutants/pops_front_not_leaving.pyscript703 B
questions/gca/sensor-median/mutants/unsorted_window.pyscript607 B
questions/gca/sensor-median/problem.mdmarkdown851 B
questions/gca/sensor-median/reference.pyscript770 B
questions/gca/sensor-median/starter.pyscript391 B

questions/gca/request-budget/tests_hidden.py

View on GitHub
"""Request Budget hidden suite.

Never copied into a session workspace.

Weighted toward the two rules a working-looking solution usually gets wrong: the
boundary is half-open, so an event at exactly at - window has gone, and a refused
request must leave no trace, or a client who hits the limit once stays limited
forever.
"""

import unittest

from solution import RateLimiter


class TestBasics(unittest.TestCase):
    def test_first_request_is_allowed(self):
        self.assertIs(RateLimiter(1, 10).allow("a", 0), True)

    def test_up_to_the_limit(self):
        limiter = RateLimiter(3, 10)
        self.assertIs(limiter.allow("a", 0), True)
        self.assertIs(limiter.allow("a", 1), True)
        self.assertIs(limiter.allow("a", 2), True)

    def test_one_past_the_limit_is_refused(self):
        limiter = RateLimiter(3, 10)
        for moment in (0, 1, 2):
            limiter.allow("a", moment)
        self.assertIs(limiter.allow("a", 3), False)

    def test_returns_actual_booleans(self):
        limiter = RateLimiter(1, 10)
        self.assertIsInstance(limiter.allow("a", 0), bool)
        self.assertIsInstance(limiter.allow("a", 1), bool)

    def test_limit_of_one(self):
        limiter = RateLimiter(1, 5)
        self.assertIs(limiter.allow("a", 0), True)
        self.assertIs(limiter.allow("a", 4), False)
        self.assertIs(limiter.allow("a", 5), True)

    def test_several_requests_can_share_a_timestamp(self):
        limiter = RateLimiter(2, 10)
        self.assertIs(limiter.allow("a", 7), True)
        self.assertIs(limiter.allow("a", 7), True)
        self.assertIs(limiter.allow("a", 7), False)

    # --- the boundary ---

    def test_an_event_exactly_a_window_old_has_expired(self):
        limiter = RateLimiter(1, 10)
        limiter.allow("a", 0)
        self.assertIs(limiter.allow("a", 10), True)

    def test_a_moment_before_the_boundary_still_counts(self):
        limiter = RateLimiter(1, 10)
        limiter.allow("a", 0)
        self.assertIs(limiter.allow("a", 9.999), False)

    def test_the_window_slides_rather_than_resetting(self):
        """A fixed bucket would let four through in a ten second span."""
        limiter = RateLimiter(2, 10)
        self.assertIs(limiter.allow("a", 8), True)
        self.assertIs(limiter.allow("a", 9), True)
        self.assertIs(limiter.allow("a", 11), False)
        self.assertIs(limiter.allow("a", 18), True)

    def test_a_long_gap_clears_everything(self):
        limiter = RateLimiter(2, 10)
        limiter.allow("a", 0)
        limiter.allow("a", 1)
        self.assertIs(limiter.allow("a", 1000), True)
        self.assertEqual(limiter.count("a", 1000), 1)

    # --- a refusal leaves no trace ---

    def test_a_refusal_does_not_fill_the_budget(self):
        """The one that turns a brief burst into a permanent ban."""
        limiter = RateLimiter(1, 10)
        limiter.allow("a", 0)
        for moment in (1, 2, 3, 4, 5, 6, 7, 8, 9):
            self.assertIs(limiter.allow("a", moment), False)
        self.assertIs(limiter.allow("a", 10), True)

    def test_refusals_do_not_show_up_in_the_count(self):
        limiter = RateLimiter(1, 10)
        limiter.allow("a", 0)
        limiter.allow("a", 1)
        limiter.allow("a", 2)
        self.assertEqual(limiter.count("a", 3), 1)

    def test_hammering_does_not_delay_recovery(self):
        limiter = RateLimiter(2, 10)
        limiter.allow("a", 0)
        limiter.allow("a", 0)
        for moment in range(1, 10):
            limiter.allow("a", moment)
        self.assertIs(limiter.allow("a", 10), True)

    # --- counting ---

    def test_count_of_an_unseen_client(self):
        self.assertEqual(RateLimiter(3, 5).count("nobody", 100), 0)

    def test_count_expires_with_the_window(self):
        limiter = RateLimiter(3, 10)
        limiter.allow("a", 0)
        limiter.allow("a", 5)
        self.assertEqual(limiter.count("a", 9), 2)   # (-1, 9]  holds 0 and 5
        self.assertEqual(limiter.count("a", 10), 1)  # (0, 10]  drops 0
        self.assertEqual(limiter.count("a", 14), 1)  # (4, 14]  still holds 5
        self.assertEqual(limiter.count("a", 15), 0)  # (5, 15]  drops 5 too

    def test_count_does_not_itself_allow_anything(self):
        limiter = RateLimiter(1, 10)
        limiter.count("a", 0)
        limiter.count("a", 1)
        self.assertIs(limiter.allow("a", 2), True)

    def test_count_never_exceeds_the_limit(self):
        limiter = RateLimiter(2, 10)
        for moment in range(20):
            limiter.allow("a", moment * 0.1)
        self.assertLessEqual(limiter.count("a", 2), 2)

    # --- clients are separate ---

    def test_two_clients_do_not_share_a_budget(self):
        limiter = RateLimiter(1, 10)
        self.assertIs(limiter.allow("alice", 0), True)
        self.assertIs(limiter.allow("bob", 0), True)
        self.assertIs(limiter.allow("carol", 0), True)

    def test_one_client_filling_up_does_not_limit_another(self):
        limiter = RateLimiter(2, 10)
        limiter.allow("alice", 0)
        limiter.allow("alice", 1)
        self.assertIs(limiter.allow("alice", 2), False)
        self.assertIs(limiter.allow("bob", 2), True)
        self.assertIs(limiter.allow("bob", 3), True)
        self.assertIs(limiter.allow("bob", 4), False)

    def test_counts_are_per_client(self):
        limiter = RateLimiter(5, 10)
        limiter.allow("alice", 0)
        limiter.allow("alice", 1)
        limiter.allow("bob", 1)
        self.assertEqual(limiter.count("alice", 2), 2)
        self.assertEqual(limiter.count("bob", 2), 1)

    def test_keys_are_case_sensitive(self):
        limiter = RateLimiter(1, 10)
        self.assertIs(limiter.allow("Alice", 0), True)
        self.assertIs(limiter.allow("alice", 0), True)

    # --- odd input ---

    def test_an_empty_key_is_refused_without_raising(self):
        limiter = RateLimiter(5, 10)
        self.assertIs(limiter.allow("", 0), False)
        self.assertEqual(limiter.count("", 0), 0)

    def test_an_empty_key_does_not_consume_anyone_else_s_budget(self):
        limiter = RateLimiter(1, 10)
        limiter.allow("", 0)
        self.assertIs(limiter.allow("a", 0), True)

    def test_negative_times(self):
        limiter = RateLimiter(2, 10)
        self.assertIs(limiter.allow("a", -100), True)
        self.assertIs(limiter.allow("a", -95), True)
        self.assertIs(limiter.allow("a", -94), False)
        self.assertIs(limiter.allow("a", -90), True)

    def test_float_times(self):
        limiter = RateLimiter(2, 1)
        self.assertIs(limiter.allow("a", 0.1), True)
        self.assertIs(limiter.allow("a", 0.5), True)
        self.assertIs(limiter.allow("a", 0.9), False)
        self.assertIs(limiter.allow("a", 1.1), True)

    def test_a_bad_limit_raises(self):
        with self.assertRaises(ValueError):
            RateLimiter(0, 10)

    def test_a_negative_limit_raises(self):
        with self.assertRaises(ValueError):
            RateLimiter(-1, 10)

    def test_a_bad_window_raises(self):
        with self.assertRaises(ValueError):
            RateLimiter(2, 0)

    def test_a_negative_window_raises(self):
        with self.assertRaises(ValueError):
            RateLimiter(2, -5)

    # --- scale ---

    def test_a_long_run_stays_correct(self):
        limiter = RateLimiter(3, 5)
        allowed = 0
        for moment in range(20000):
            if limiter.allow("a", moment * 0.1):
                allowed += 1
        # 0.1s apart with a 5s window is 50 slots per window, and only 3 of any
        # 50 get through, so this lands far below the request count.
        self.assertLess(allowed, 2000)
        self.assertGreater(allowed, 900)

    def test_many_clients(self):
        limiter = RateLimiter(1, 10)
        for index in range(5000):
            self.assertIs(limiter.allow("client-%d" % index, 0), True)
        for index in range(5000):
            self.assertIs(limiter.allow("client-%d" % index, 5), False)

    def test_history_does_not_grow_without_bound(self):
        """Rescanning everything is the shape that dies here."""
        limiter = RateLimiter(2, 1)
        for moment in range(100000):
            limiter.allow("a", moment)
        self.assertEqual(limiter.count("a", 99999), 1)


if __name__ == "__main__":
    unittest.main()
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall