project_folder/
├── app/
│ ├── static/
│ │ └── ...
│ ├── templates/
│ │ └── ...
│ ├── extensions/
│ │ └── __init__.py
│ └── __init__.py
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
from datetime import datetime, date | |
import typing as t | |
from sqlalchemy import ( | |
Result, | |
Select, | |
Insert, | |
Update, | |
Delete, | |
select, |
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
from enum import Enum | |
class Colors(Enum): | |
BLACK = '#000000' | |
NIGHT = '#0C090A' | |
CHARCOAL = '#34282C' | |
OIL = '#3B3131' | |
DARK_GRAY = '#3A3B3C' | |
LIGHT_BLACK = '#454545' |
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 pathlib | |
import random | |
from textwrap import dedent | |
from flask import Flask, request, abort | |
from werkzeug.utils import secure_filename | |
def create_app(): | |
app = Flask(__name__, static_url_path="/") |
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
// imports here | |
const server_url = '127.0.0.1:5000'; | |
export default function Client() { | |
const url_params = useParams(); | |
// places dely on the amount of times a function is called, used in the form input onInput tag. | |
function debounce(func, timeout = 300) { | |
let timer; |
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
# | |
# With help from : https://github.com/jonbiemond | |
# | |
# requires: | |
# pip install flask flask_sqlalchemy | |
# | |
# run: flask --app sqlalchemy_to_josnable_dict.py init-db | |
# run: flask --app sqlalchemy_to_josnable_dict.py test-data | |
# run: flask --app sqlalchemy_to_josnable_dict.py get-user1 | |
# run: flask --app sqlalchemy_to_josnable_dict.py get-user2 |
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
from email.mime.application import MIMEApplication | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from pathlib import Path | |
from smtplib import SMTP | |
from smtplib import SMTPException | |
from ssl import create_default_context | |
from typing import Optional, Union | |
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 random | |
import timeit | |
from datetime import datetime | |
from datetime import timedelta | |
from pytz import timezone | |
def epoch(ltz: str = "Europe/London") -> int: | |
""" |
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
value1 = True | |
value2 = False | |
if value1: | |
print("#1 value1 is true") | |
if value2: | |
print("#2 value2 is true") |
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the\
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
NewerOlder