Skip to content

Instantly share code, notes, and snippets.

View finete's full-sized avatar

finete finete

View GitHub Profile
@nickretallack
nickretallack / env.py
Last active March 16, 2023 20:57
How to run multi-tenant migrations in alembic.
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool, MetaData, Table, ForeignKeyConstraint
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
@nickoala
nickoala / 0_python_email.md
Last active June 16, 2024 12:58
Use Python to send and receive emails

Use Python to:

  • send a plain text email
  • send an email with attachment
  • receive and filter emails according to some criteria
@maxfischer2781
maxfischer2781 / multiprocess_gc.py
Created November 27, 2018 15:53
Test for behaviour of GC in python multiprocessing using regular/shared objects
import multiprocessing
import time
import sys
process_identifier = 'main'
class Collectible:
def __init__(self, identifier):
self.identifier = identifier
@lneeraj97
lneeraj97 / install-conda.sh
Last active January 9, 2020 16:36 — forked from arose13/install-conda.sh
Install Miniconda in Ubuntu
# Setup Ubuntu
sudo apt update --yes
sudo apt upgrade --yes
# Get Miniconda and make it the main Python interpreter
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p ~/miniconda
rm ~/miniconda.sh
export PATH=~/miniconda/bin:$PATH