Skip to content

Instantly share code, notes, and snippets.

@travishathaway
travishathaway / pyscopg2_decorator.py
Last active July 9, 2023 16:38
Postgres Connections with Python Decorators
from functools import wraps
import psycopg2
####################
# Define Decorator #
####################
def psycopg2_cursor(conn_info):
"""Wrap function to setup and tear down a Postgres connection while
providing a cursor object to make queries with.
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes