Skip to content

Instantly share code, notes, and snippets.

View cesarferradas's full-sized avatar
🐙

César Ferradas cesarferradas

🐙
View GitHub Profile
@cesarferradas
cesarferradas / install.sh
Created October 17, 2021 09:55
Script to expose Plausible analytics via SSL
custom_domain=yourdomain.com
certbot_email=user@yourdomain.com
sudo apt -qqy update
sudo apt -qqy install nginx
sudo apt -qqy install certbot python3-certbot-nginx ufw
sudo systemctl enable nginx
sudo systemctl start nginx
ufw allow ssh && ufw allow http && ufw allow https && ufw allow 8000 && ufw --force enable
@cesarferradas
cesarferradas / logging.py
Created April 8, 2021 09:10
Python framework agnostic logging setup
import logging
import os
import sys
import time
from app import settings
def setup_logging():
"""
def to_schema_type(t):
'''
Convert SQL Alchemy data types to Open API compatible strings
'''
if t in [sqlt.TEXT, sqlt.VARCHAR, sqlt.CHAR, sqlt.Enum, sqlt.DateTime, sqlt.Date]:
return 'string'
if t in [sqlt.INT, sqlt.INTEGER, sqlt.BIGINT]:
return 'integer'
if t in [sqlt.BOOLEAN]:
return 'boolean'