Skip to content

culiops/culiops-skills / skills/sre-investigate

sre-investigate

Unverified

FileKindSize
SKILL.mdskill md71.5 KB
access/standalone.mdmarkdown19.0 KB
agents/evidence.mdmarkdown8.1 KB
agents/helper.mdmarkdown3.9 KB
analytics/bin/logs-fetchexecutablescript229 B
analytics/bin/logs-inventoryexecutablescript209 B
analytics/bin/logs-statusexecutablescript192 B
analytics/bin/sqlqexecutablescript212 B
analytics/lib/s3logs/__init__.pyscript62 B
analytics/lib/s3logs/awscli.pyscript10.0 KB
analytics/lib/s3logs/budget.pyscript9.6 KB
analytics/lib/s3logs/cli_fetch.pyscript34.0 KB
analytics/lib/s3logs/cli_inventory.pyscript7.0 KB
analytics/lib/s3logs/cli_sqlq.pyscript18.4 KB
analytics/lib/s3logs/cli_status.pyscript3.0 KB
analytics/lib/s3logs/config.pyscript7.4 KB
analytics/lib/s3logs/convert.pyscript23.6 KB
analytics/lib/s3logs/duck.pyscript11.4 KB
analytics/lib/s3logs/layout.pyscript8.8 KB
analytics/lib/s3logs/paths.pyscript4.9 KB
analytics/lib/s3logs/redact.pyscript22.1 KB
analytics/lib/s3logs/s5.pyscript9.1 KB
analytics/lib/s3logs/sqlguard.pyscript11.8 KB
analytics/lib/s3logs/validate.pyscript4.4 KB
analytics/logs.env.exampleother4.2 KB
analytics/sql/alb/by_minute.sqlother918 B
analytics/sql/alb/lb_vs_target_status.sqlother629 B
analytics/sql/alb/status_by_target.sqlother887 B
analytics/sql/alb/summary.sqlother1.2 KB
analytics/sql/alb/target_latency_pct.sqlother1.4 KB
analytics/sql/alb/top_clients.sqlother429 B
analytics/sql/alb/top_paths_5xx.sqlother673 B
analytics/sql/cloudfront/aborted.sqlother1.1 KB
analytics/sql/cloudfront/by_day.sqlother499 B
analytics/sql/cloudfront/by_hour.sqlother489 B
analytics/sql/cloudfront/by_object.sqlother544 B
analytics/sql/cloudfront/bytes_per_viewer.sqlother1.1 KB
analytics/sql/cloudfront/cache_results.sqlother823 B
analytics/sql/cloudfront/client_concentration.sqlother707 B
analytics/sql/cloudfront/edges.sqlother434 B
analytics/sql/cloudfront/object_by_day.sqlother599 B
analytics/sql/cloudfront/range_requests.sqlother528 B
analytics/sql/cloudfront/referer_pages.sqlother393 B
analytics/sql/cloudfront/status_codes.sqlother342 B
analytics/sql/cloudfront/summary.sqlother719 B
analytics/sql/cloudfront/top_clients.sqlother353 B
analytics/sql/cloudfront/top_objects.sqlother349 B
analytics/sql/cloudfront/top_referers.sqlother492 B
analytics/sql/cloudfront/user_agents.sqlother533 B
analytics/sql/waf/asns.sqlother378 B
analytics/sql/waf/by_day.sqlother453 B
analytics/sql/waf/by_minute.sqlother314 B
analytics/sql/waf/client_keys.sqlother443 B
analytics/sql/waf/clients.sqlother521 B
analytics/sql/waf/compare_days.sqlother924 B
analytics/sql/waf/concentration.sqlother775 B
analytics/sql/waf/count_rules.sqlother556 B
analytics/sql/waf/countries.sqlother373 B
analytics/sql/waf/fingerprints.sqlother424 B
analytics/sql/waf/header_shape.sqlother425 B
analytics/sql/waf/labels.sqlother347 B
analytics/sql/waf/matched_data.sqlother530 B
analytics/sql/waf/rules_by_minute.sqlother497 B
analytics/sql/waf/summary.sqlother735 B
analytics/sql/waf/top_rules.sqlother361 B
analytics/sql/waf/uris.sqlother402 B
analytics/sql/waf/user_agents.sqlother557 B
analytics/tests/conftest.pyscript4.7 KB
analytics/tests/gen_fixtures.pyscript19.7 KB
analytics/tests/stubs/awsexecutablescript4.9 KB
analytics/tests/stubs/s5cmdexecutablescript4.5 KB
analytics/tests/test_awscli.pyscript16.0 KB
analytics/tests/test_budget.pyscript13.3 KB
analytics/tests/test_config.pyscript9.1 KB
analytics/tests/test_convert.pyscript25.9 KB
analytics/tests/test_duck.pyscript10.6 KB
analytics/tests/test_fetch.pyscript42.8 KB
analytics/tests/test_gen_fixtures.pyscript1.9 KB
analytics/tests/test_inventory.pyscript12.9 KB
analytics/tests/test_layout.pyscript9.8 KB
analytics/tests/test_named_queries.pyscript26.7 KB
analytics/tests/test_paths.pyscript3.2 KB
analytics/tests/test_redact.pyscript32.0 KB
analytics/tests/test_s5.pyscript17.8 KB
analytics/tests/test_sqlguard.pyscript10.8 KB
analytics/tests/test_sqlq.pyscript37.2 KB
analytics/tests/test_status.pyscript5.8 KB
analytics/tests/test_validate.pyscript2.9 KB
environment.template.mdmarkdown7.1 KB
playbooks/changes.mdmarkdown37.2 KB
playbooks/errors.mdmarkdown10.4 KB
playbooks/external.mdmarkdown15.4 KB
playbooks/infra-state.mdmarkdown13.7 KB
playbooks/logs-s3.mdmarkdown29.5 KB
playbooks/logs.mdmarkdown21.3 KB
playbooks/metrics.mdmarkdown39.0 KB
playbooks/other-backends.mdmarkdown7.2 KB
playbooks/traces.mdmarkdown16.2 KB
playbooks/waf.mdmarkdown17.2 KB
templates/incident.mdmarkdown3.9 KB
templates/ledger.mdmarkdown9.7 KB
templates/lesson.mdmarkdown2.7 KB
templates/profile.mdmarkdown4.5 KB
templates/report.mdmarkdown6.5 KB

analytics/tests/conftest.py

View on GitHub
"""Shared fixtures for the S3 log module tests.

Tests never touch real AWS or the real home directory: HOME points at a tmp dir
and external tools are replaced by stub scripts on PATH.
"""
from __future__ import annotations

import os
import shlex
import shutil
import stat
import sys
from pathlib import Path

import pytest

ANALYTICS = Path(__file__).resolve().parent.parent
LIB = ANALYTICS / "lib"
BIN = ANALYTICS / "bin"

if str(LIB) not in sys.path:
    sys.path.insert(0, str(LIB))

# Captured at import time, before any fixture re-points HOME or PATH at a tmp dir.
_REAL_HOME = os.path.expanduser("~")
_ORIGINAL_PATH = os.environ.get("PATH", "")
STUBS = ANALYTICS / "tests" / "stubs"


@pytest.fixture
def home(tmp_path, monkeypatch):
    """A tmp dir set as HOME, so Path.home() resolves to it."""
    h = tmp_path / "home"
    h.mkdir()
    monkeypatch.setenv("HOME", str(h))
    yield h
    # staging/ is mode 0300 and dataset dirs 0555; make everything removable so pytest can clean up.
    for dirpath, dirnames, _files in os.walk(str(h)):
        for d in dirnames:
            full = os.path.join(dirpath, d)
            if not os.path.islink(full):
                os.chmod(full, 0o700)


class StubPath:
    """A tmp bin dir prepended to PATH, plus helpers to write stub executables."""

    def __init__(self, directory: Path, monkeypatch):
        self.dir = directory
        self._monkeypatch = monkeypatch
        self._original_path = os.environ.get("PATH", "")
        monkeypatch.setenv("PATH", str(directory) + os.pathsep + self._original_path)

    def isolate(self) -> None:
        """PATH becomes only the stub dir, so real s5cmd/duckdb are not found."""
        self._monkeypatch.setenv("PATH", str(self.dir))

    def write_script(self, name: str, body: str) -> Path:
        """Write an executable /bin/sh script with the given body."""
        p = self.dir / name
        p.write_text("#!/bin/sh\n" + body.rstrip("\n") + "\n")
        p.chmod(p.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
        return p

    def write(self, name: str, stdout: str = "", exit_code: int = 0) -> Path:
        """Write a stub that prints `stdout` (whatever its arguments) and exits."""
        body = "printf '%s\\n' {}\nexit {}".format(shlex.quote(stdout), int(exit_code))
        return self.write_script(name, body)


@pytest.fixture
def stub_path(tmp_path, monkeypatch):
    d = tmp_path / "stubbin"
    d.mkdir()
    return StubPath(d, monkeypatch)


@pytest.fixture
def duckdb_bin():
    """Path to the real duckdb CLI; skip when it is not installed."""
    found = (shutil.which("duckdb", path=_ORIGINAL_PATH)
             or os.path.join(_REAL_HOME, ".local", "bin", "duckdb"))
    if not os.access(found, os.X_OK):
        pytest.skip("duckdb CLI not installed (expected on PATH or ~/.local/bin/duckdb)")
    return found


class FakeS3:
    """Stub `aws` (and any other stub in tests/stubs) on PATH over a fake bucket tree."""

    def __init__(self, root: Path, argv_log: Path):
        self.root = root
        self.argv_log = argv_log

    def bucket(self, name: str) -> Path:
        """Create (if needed) and return the directory standing in for a bucket."""
        p = self.root / name
        p.mkdir(parents=True, exist_ok=True)
        return p

    def s5env(self) -> list:
        """The AWS_*/S5CMD_*/S3_* environment of every s5cmd start, as a list of dicts."""
        import json
        path = Path(str(self.argv_log) + ".s5env")
        if not path.exists():
            return []
        return [json.loads(line) for line in path.read_text().splitlines() if line.strip()]

    def calls(self) -> list:
        """Every logged stub invocation, as a list of argv lists."""
        import json
        if not self.argv_log.exists():
            return []
        return [json.loads(line) for line in self.argv_log.read_text().splitlines() if line.strip()]


@pytest.fixture
def fake_s3(tmp_path, monkeypatch, stub_path):
    """Install the stubs from tests/stubs on PATH, backed by a tmp FAKE_S3_ROOT."""
    for stub in sorted(STUBS.iterdir()):
        if stub.is_file() and os.access(str(stub), os.X_OK):
            target = stub_path.dir / stub.name
            shutil.copyfile(str(stub), str(target))
            target.chmod(0o755)
    root = tmp_path / "fake-s3"
    root.mkdir()
    log = tmp_path / "argv.log"
    monkeypatch.setenv("FAKE_S3_ROOT", str(root))
    monkeypatch.setenv("FAKE_ARGV_LOG", str(log))
    for var in ("FAKE_AWS_ERROR", "FAKE_EXTRA_KEYS_JSON", "FAKE_AWS_CREDS_ERROR", "FAKE_AWS_CREDS_STDOUT",
                "FAKE_AWS_CREDS_STDOUT_AND_FAIL", "FAKE_AWS_CREDS_NO_TOKEN", "FAKE_S5CMD_ECHO_ENV"):
        monkeypatch.delenv(var, raising=False)
    return FakeS3(root, log)
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