Skip to content

Instantly share code, notes, and snippets.

View Filimoa's full-sized avatar

Sergey Filimonov Filimoa

View GitHub Profile
@Filimoa
Filimoa / fastapi_redis_dependency.py
Created October 18, 2023 00:53
Fastapi Redis Dependency
"""
Much of this was borrowed from:
https://github.com/Tert0/fastapi-framework/blob/develop/fastapi_framework/redis.py
Assumes redis = "^4.5.1"
Meant to be used like this:
@app.on_event("startup")
async def on_startup():
@Filimoa
Filimoa / gist:f7a67de0d7b7d9c9693253f00a20a045
Created August 21, 2023 22:56
Multiple Bases Getting Combined SqlAlchemy
from src.app.db.base import Base as AppBase # noqa
from src.b2b.db.base import Base as B2BBase # noqa
target_metadata = MetaData()
for table in AppBase.metadata.tables.values():
table.tometadata(target_metadata)
for table in B2BBase.metadata.tables.values():
table.tometadata(target_metadata)
@Filimoa
Filimoa / leetcode_sql_problem_statements_to_db_tables.py
Last active October 1, 2022 01:48
LeetCode SQL Problem Statement to local database
import re
from typing import Dict
from io import StringIO
from dateutil import parser
from sqlalchemy import create_engine
import pandas as pd
def is_date(string):
if string.isnumeric():
@Filimoa
Filimoa / app.py
Last active September 21, 2024 10:27
FastAPI Stripe Checkout
"""
Based off Stripe's checkout repo, see the link for the Flask analogue.
https://github.com/stripe-samples/checkout-one-time-payments/blob/master/server/python/server.py
Assumes project is structured like:
src/
backend/
app.py