Example on how to use howler.js
This requires howler.js
to be in the same folder as all these files. It can be found in the dist
folder of the howler.js download.
""" | |
This module contains classes that dispatch calls depending on arg-types. | |
The goal is to handle "media-types" for HTTP APIs with well-defined functions. | |
An "incoming" request may contain a payload that needs to be stored in the | |
back-end. We need to "parse/decode" the incoming object depending on media-type. | |
Similarly, when we respond to the request we may need to convert the object to | |
something the client understands. The client can opt-in/-out using the "Accept" | |
media-type. |
#!/bin/bash | |
# ----------------------------------------------------------------------------- | |
# This script extracts the path of the devcontainer config-file from | |
# docker-events. | |
# | |
# This helps in identifying who has started a container if the container-name | |
# does not itself include any indication. | |
# | |
# This can be used to determine if a container can be safely stopped/removed |
from fastapi import Depends, FastAPI | |
from pydantic import BaseModel | |
from sqlalchemy import Column, Integer, String | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import Query, Session | |
from pagination import PaginatedList, paginated_get | |
Base = declarative_base() |
{ | |
"[sql]": { | |
"editor.formatOnSave": false | |
} | |
} |
Example on how to use howler.js
This requires howler.js
to be in the same folder as all these files. It can be found in the dist
folder of the howler.js download.
Stream URL: https://twitch.tv/exhuma
Some days I may work on other project from my GitHub repositories for general housekeeping.
""" | |
Helper functions for unit-testing with SQLAlchemy | |
This provides a context-manager "rb_session" which | |
creates a new session that ignores all ".commit()" | |
calls. This might not work with all databases. It | |
has been tested with PostgreSQL. Verify that the | |
commits are really ignored if you use any other DB. | |
""" |
import logging | |
import sys | |
from logging.handlers import QueueHandler, QueueListener | |
from queue import Queue | |
from time import sleep | |
class FlushingHandler(QueueHandler): | |
def flush(self): | |
super().flush() |
class ScannedPort: | |
label: str = "" | |
clsas ScannedDevice: | |
hostname: str = "" | |
ports: List[ScannedPort] = [] | |
class Port(Base): | |
hostname = Column(String, ForeignKey("Device.hostname") | |
label = Column(String) |