Skip to content

Instantly share code, notes, and snippets.

View Filimoa's full-sized avatar

Sergey Filimonov Filimoa

View GitHub Profile
@Filimoa
Filimoa / app.py
Last active July 23, 2025 04:44
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
@Filimoa
Filimoa / leetcode_sql_problem_statements_to_db_tables.py
Last active April 11, 2025 05:04
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 / 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 / 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():
from typing import Literal
from bank_database import DatabaseConn
from openai_sdk import client
from pydantic import BaseModel, Field
RESPOND_TO_USER_QUERY_SYSTEM_PROMPT = """
You are a support agent in our bank, give the best advice to the user based on their query.
If the user is asking for their balance, give them the balance.
@Filimoa
Filimoa / example.py
Created January 19, 2025 02:19
Polars With Cosine Similarity
# !uv pip install polars polars_distance numpy
import polars_distance as pld
import polars as pl
import numpy as np
import time
dims = 512
num_rows = 250_000
from pathlib import Path
import openparse
# directory for sample PDF's
PDF_DIR = Path("../data") / "pdfs"
# output dir
GT_DIR = Path("../data") / "ground_truth"
@Filimoa
Filimoa / README.md
Created August 14, 2026 21:31
Live Modal smoke test for run-scoped SandboxAgent working directories (openai-agents-python PR #4421)

Run-scoped sandbox working directory: live Modal smoke test

This gist is a supplemental live-provider reproduction for openai/openai-agents-python#4421, which implements the feature requested in openai/openai-agents-python#4401.

The harness was prepared and verified against commit 4fb4c535b58b7b705f80798c9fd0681e10eed98d. It creates one Modal sandbox, shares that live session across concurrent SandboxAgent runs, and gives every run a distinct SandboxRunConfig.cwd.

It uses ScriptedModel and disables trace export, so it exercises the real SDK runner, sandbox capabilities, and Modal transport without requiring an OpenAI API key or depending on model behavior.

What it checks