Skip to content

Instantly share code, notes, and snippets.

View paulorodriguesxv's full-sized avatar

Paulo Leonardo Vieira Rodrigues paulorodriguesxv

View GitHub Profile
@timhughes
timhughes / fastapi_websocket_redis_pubsub.py
Last active April 29, 2024 08:00
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
@mblondel
mblondel / projection_simplex.py
Last active May 16, 2024 16:53
Projection onto the simplex
"""
License: BSD
Author: Mathieu Blondel
Implements three algorithms for projecting a vector onto the simplex: sort, pivot and bisection.
For details and references, see the following paper:
Large-scale Multiclass Support Vector Machine Training via Euclidean Projection onto the Simplex
Mathieu Blondel, Akinori Fujino, and Naonori Ueda.
@mtearle
mtearle / EXAMPLE-socket.py
Created October 14, 2014 15:31
npyscreen EXAMPLE of a socket connection updating widgets
#!/usr/bin/env python
import npyscreen, curses
# Incorporates code
# from http://www.binarytides.com/python-socket-server-code-example/
# Socket server in python using select function
import socket, select
class MyTestApp(npyscreen.NPSAppManaged):
# socket code
@lepinkainen
lepinkainen / while_waiting.py
Created February 11, 2014 17:18
npyscreen while_waiting minimal example - doesn't work
import npyscreen
from datetime import datetime
class DateForm(npyscreen.Form):
def while_waiting(self):
npyscreen.notify_wait("Update")
self.display()
def create(self):
self.add(npyscreen.FixedText, value=datetime.now(), editable=False)