Skip to content

Instantly share code, notes, and snippets.

@eshafik
eshafik / fastapi_kafka_integration_aiokafka.md
Created January 16, 2024 18:27
FastAPI and Kafka Integration with aiokafka [ Consumer and Producer]

Producer:

Create a sperate file like producer.py -

import json
import ssl

from aiokafka import AIOKafkaProducer

from conf.app_vars import KAFKA_HOST, KAFKA_USERNAME, KAFKA_PASSWORD
@noelbundick
noelbundick / README.md
Created October 14, 2021 16:15
Optimizing Rust container builds

Optimizing Rust container builds

I'm a Rust newbie, and one of the things that I've found frustrating is that the default docker build experience is extremely slow. As it downloads crates, then dependencies, then finally my app - I often get distracted, start doing something else, then come back several minutes later and forget what I was doing

Recently, I had the idea to make it a little better by combining multistage builds with some of the amazing features from BuildKit. Specifically, cache mounts, which let a build container cache directories for compilers & package managers. Here's a quick annotated before & after from a real app I encountered.

Before

This is a standard enough multistage Dockerfile. Nothing seemingly terrible or great here - just a normal build stage, and a smaller runtime stage.

@savanovich
savanovich / .gdbinit
Last active April 15, 2025 05:57
GDB cheatsheet
define pyp
set \$\_unused\_void = PyObject\_Print($arg0, stderr, 1)
printf "\n"
end