Skip to content

Instantly share code, notes, and snippets.

View caseydm's full-sized avatar

Casey Meyer caseydm

View GitHub Profile
@debashisdeb
debashisdeb / debug_stuff.py
Last active March 13, 2023 15:58 — forked from dhrrgn/debug_stuff.py
A handy SQL debug function for Flask-SQLAlchemy
from . import app
from flask.sqlalchemy import get_debug_queries
if app.debug:
app.after_request(sql_debug)
def sql_debug(response):
queries = list(get_debug_queries())
query_str = ''
@hrldcpr
hrldcpr / tree.md
Last active September 1, 2024 07:04
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!