Skip to content

Instantly share code, notes, and snippets.

View verhovensky's full-sized avatar
💭
"To a real warrior, power perceived may be power achieved."

BH verhovensky

💭
"To a real warrior, power perceived may be power achieved."
View GitHub Profile
@nymous
nymous / README.md
Last active November 14, 2025 12:05
Logging setup for FastAPI, Uvicorn and Structlog (with Datadog integration)

Logging setup for FastAPI

This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.

Then, you can use Structlog loggers or standard logging loggers, and they both will be processed by the Structlog pipeline (see the hello() endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!

Requests are assigned a correlation ID with the asgi-correlation-id middleware (either captured from incoming request or generated on the fly). All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented. This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog. You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom

@oficsu
oficsu / kscreenlocker-layout-switcher.sh
Last active July 23, 2025 20:26
Enable only us keyboard layout in the KDE Plasma screenlocker and disable others
#!/bin/bash
# MIT License
#
# Copyright (c) 2024 Ofee Oficsu
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@SamWarden
SamWarden / async_db_fixtures.py
Last active July 15, 2025 07:59
This is an example of fixtures for tests that depend on a Postgres database
import uuid
from collections.abc import AsyncGenerator, Generator
from typing import cast
import alembic.command
import pytest
from alembic.config import Config as AlembicConfig
from sqlalchemy import URL, Connection, text
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, async_sessionmaker, create_async_engine
from testcontainers.postgres import PostgresContainer
@artemgetmann
artemgetmann / claude-code-token-saving-guide.md
Last active December 4, 2025 01:09
Practical workflow for reducing token usage in Claude Code while preserving session continuity. Includes compacting strategies, CLAUDE.md structure, modular context management, and prompt engineering tips.

🧠 How to Save Context Tokens When Using Claude Code

This is a personal reference workflow for minimizing token usage while maintaining project continuity across Claude Code (Sonnet 4 with file access).


✅ Setup: Populate CLAUDE.md

Claude loads CLAUDE.md automatically at session start.