Skip to content

Instantly share code, notes, and snippets.

View deepanshumehtaa's full-sized avatar
💭
If Good things are not coming to you, Snatch them™

Deepanshu mehta deepanshumehtaa

💭
If Good things are not coming to you, Snatch them™
View GitHub Profile
@deepanshumehtaa
deepanshumehtaa / Docker Commands.txt
Last active April 9, 2025 20:31
Docker Commands
permission issues:
> ls -l /var/run/docker.sock
> sudo chmod 666 /var/run/docker.sock
Create a Docker Image: (assuming you already have Dockerfile in ur folder)
> docker build -t <my-image-name> .
RUN .........................................
Run a built created image
@deepanshumehtaa
deepanshumehtaa / Backgrond tasks in FastAPI.py
Last active April 26, 2025 11:16
Backgrond tasks in FastAPI
# gunicorn -w 2 -k uvicorn.workers.UvicornWorker main:app --max-requests 100 --max-requests-jitter 10 --threads 5
# ..........................................................................................
import asyncio
import os
import logging
# from asyncio.log import logger
from time import sleep
@deepanshumehtaa
deepanshumehtaa / docker-compose-kafka.yaml
Created April 27, 2025 11:43
docker-compose-kafka.yaml
version: '3'
services:
zookeeper:
# image: confluentinc/cp-zookeeper:latest
image: bitnami/zookeeper:3.9
container_name: zookeeper
ports:
- "2181:2181"
environment:
ALLOW_ANONYMOUS_LOGIN: 1
@deepanshumehtaa
deepanshumehtaa / python socket server - post api.py
Created May 13, 2025 13:15
python socket server - post api.py
import json
import socket
def parse_http_request(request):
headers, _, body = request.partition("\r\n\r\n")
request_line = headers.splitlines()[0]
method, path, _ = request_line.split()
return method, path, headers, body
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)