Skip to content

Instantly share code, notes, and snippets.

View exhuma's full-sized avatar
🐢
Slowly advancing on hobby projects

Michel Albert exhuma

🐢
Slowly advancing on hobby projects
View GitHub Profile
@exhuma
exhuma / example.py
Last active April 14, 2024 10:25
Automatic Pagination with FastAPI and SQLAlchemy
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()
@exhuma
exhuma / colortrace.py
Last active March 5, 2024 11:04
Fancy Colorful Python Traceback
'''
This module provides a function ``make_except_hook`` which returns a function
usable as replacement for ``sys.excepthook``.
All imports are done dynamically to make this function a self-contained,
copy/pasteable piece of code.
Requires the "blessings" module to work!
--- License - (MIT) ----------------------------------------------------------
@exhuma
exhuma / wincred.py
Last active February 26, 2024 10:15 — forked from mrh1997/wincred.py
Retrieve Windows Credential via Python
"""
Access windows credentials
Credentials must be stored in the Windows Credentials Manager in the Control
Panel. This helper will search for "generic credentials" under the section
"Windows Credentials"
Example usage::
result = get_generic_credential('foobar')
@exhuma
exhuma / fetchedvalue.py
Created March 5, 2020 14:11
SQLAlchemy demonstration of the "FetchedValue" feature
"""
This file demonstrated using the "FetchedValue" feature of SQLAlchemy for
values which are generated by the DB, without knowing *how* they are generated
in the DB.
"""
from sqlalchemy import Column, DateTime, FetchedValue, Unicode, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
@exhuma
exhuma / settings.json
Created November 28, 2023 15:29
Don't auto-format SQL files in VS-Code
{
"[sql]": {
"editor.formatOnSave": false
}
}
@exhuma
exhuma / valuable_items.mermaid
Last active September 10, 2022 20:31
No Man's Sky -- Valuable Items Construcion / Requirements Tree
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@exhuma
exhuma / README.md
Last active March 21, 2021 12:41
howler example

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.

@exhuma
exhuma / PROJECTS.rst
Last active December 31, 2020 10:28
Project Description

Projects I maintain on stream

Stream URL: https://twitch.tv/exhuma

Current Focus: "WickedShout"
Secondary: "x690", "melldechof"

Some days I may work on other project from my GitHub repositories for general housekeeping.

@exhuma
exhuma / harness.py
Last active September 26, 2020 10:16
Test-Harness for SQLAlchemy unit-tests
"""
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.
"""
@exhuma
exhuma / lsmw.py
Last active August 21, 2020 05:32
WSGI middleware setting up a queue log handler
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()