This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Neo4j async | |
from neo4j import GraphDatabase | |
from neo4j.exceptions import ServiceUnavailable | |
import logging | |
import asyncio | |
NEO4J_HOST = 'localhost' | |
NEO4J_USER = 'neo4j' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install build-essential checkinstall | |
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev \ | |
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev | |
cd /usr/src | |
sudo wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz | |
sudo tar xzf Python-3.7.4.tgz | |
cd Python-3.7.4 | |
sudo ./configure --enable-optimizations | |
sudo make altinstall | |
python3.7 -V |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def clone_model(model): | |
"""Clone an arbitrary sqlalchemy model object without its primary key values.""" | |
# Ensure the model’s data is loaded before copying. | |
model.id | |
table = model.__table__ | |
non_pk_columns = [k for k in table.columns.keys() if k not in table.primary_key] | |
data = {c: getattr(model, c) for c in non_pk_columns} | |
data.pop('id') | |
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python3 | |
import base64 | |
import hashlib | |
from Crypto.Cipher import AES | |
from Crypto import Random | |
class AESCipher(object): | |
def __init__(self, key): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! python3.7 | |
from email.message import EmailMessage | |
import smtplib | |
from pathlib import Path | |
def send_simple_message(email, subject, html, from_subject="Company Name", bcc="", attachment=None): | |
from_address = 'no-reply@domain.com' | |
auth_user = '' | |
auth_password = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from bson import ObjectId | |
import datetime | |
from aiohttp import web | |
from aiohttp.client_exceptions import ClientConnectorError | |
import logging | |
from uuid import uuid4 | |
import pandas as pd | |
from io import BytesIO | |
import hashlib |