Skip to content

Instantly share code, notes, and snippets.

View rozeappletree's full-sized avatar
🐊
Dedicated to the fool & the foolish.

Asapanna Rakesh rozeappletree

🐊
Dedicated to the fool & the foolish.
View GitHub Profile
@rozeappletree
rozeappletree / __init__.py
Last active November 15, 2021 23:44
FASTAPI Boilerplate
# empty
@timhughes
timhughes / fastapi_websocket_redis_pubsub.py
Last active February 21, 2025 08:41
FastAPI Websocket Bidirectional Redis PubSub
"""
Usage:
Make sure that redis is running on localhost (or adjust the url)
Install uvicorn or some other asgi server https://asgi.readthedocs.io/en/latest/implementations.html
pip install -u uvicorn
Install dependencies
@blaylockbk
blaylockbk / multipro_template.py
Last active January 5, 2025 12:08
Template for Python multiprocessing and multithreading
import multiprocessing
from multiprocessing.dummy import Pool as ThreadPool
import numpy as np
def my_multipro(items, func, max_cpus=12):
"""Do an embarrassingly parallel task using multiprocessing.
Use this for CPU bound tasks.
@martinsik
martinsik / circle_detection.py
Last active April 22, 2023 09:50
Circle detection with OpenCV 3.0
import cv2
import time
import math
import numpy as np
capture = cv2.VideoCapture(0)
print capture.get(cv2.CAP_PROP_FPS)
t = 100
w = 640.0