Skip to content

Instantly share code, notes, and snippets.

@dfrankow
dfrankow / simple_flask_server.py
Last active November 3, 2022 14:36
simple flask server
#!/usr/bin/env python3
"""See flask.palletsprojects.com. This used Flask 1.1.1. Run with:
FLASK_APP=simple_flask_server.py flask run -h 127.0.0.1
"""
from flask import Flask, request
@dfrankow
dfrankow / prepare.py
Last active November 27, 2019 21:33 — forked from dvarrazzo/prepare.py
An example of psycopg2 cursor supporting prepared statements
#!/usr/bin/env python
"""An example of cursor dealing with prepared statements.
A cursor can be used as a regular one, but has also a prepare() statement. If
prepare() is called, execute() and executemany() can be used without query: in
this case the parameters are passed to the prepared statement. The functions
also execute the prepared statement if the query is the same prepared before.
Prepared statements aren't automatically deallocated when the cursor is
deleted, but are when the cursor is closed. For long-running sessions creating
@dfrankow
dfrankow / simple_server.py
Last active February 26, 2024 12:23
Simple HTTP REST server in python3
#!/usr/bin/env python
"""A simple HTTP server with REST and json for python 3.
addrecord takes utf8-encoded URL parameters
getrecord returns utf8-encoded json.
"""
import argparse
import json
@dfrankow
dfrankow / shap-on-p2p-loans-blogpost.ipynb
Last active December 31, 2020 09:04
notebook with "Case study: explaining credit modeling predictions with SHAP"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.