Skip to content

Instantly share code, notes, and snippets.

View sockheadrps's full-sized avatar

Ryan sockheadrps

  • Ohio
  • 15:28 (UTC -04:00)
View GitHub Profile
1. Creature new Sudo acc
-adduser ryan
-usermod -aG sudo ryan
-su - ryan
2.update repository
-sudo apt-get update
3. Install pip and nginx
-sudo apt-get install python-pip nginx
@sockheadrps
sockheadrps / client.py
Created December 9, 2024 12:36
Websocket Server and client using Python and FastAPI, Pydantic, Asyncio and Websockets
# py_websockets/client/main.py
import asyncio
from typing import Any, Dict
import websockets
from pydantic import BaseModel
from py_websockets.models.models import WebsocketConnect
class WebsocketEvent(BaseModel):
event: str
@sockheadrps
sockheadrps / DecoratorFactory.py
Created March 16, 2025 00:13
This is an example of a Decorator Factory in python, used in the youtube short: https://www.youtube.com/watch?v=H_0vd0h1_b8&lc=Ugw3j1mHk4fWXCU_0Sp4AaABAg
from datetime import datetime
def new_event(functions: dict, event: str):
def func(callback):
def wrapper(self):
return callback(self)
functions[event] = wrapper
return callback