Skip to content

Instantly share code, notes, and snippets.

View rastr-0's full-sized avatar
🇺🇦

Roman Milko rastr-0

🇺🇦
View GitHub Profile
@rochacbruno
rochacbruno / fastapi_session.py
Last active November 9, 2024 20:33
Session based cookie auth fastapi
from fastapi import Request, Depends, HTTPException, Response
from fastapi.responses import RedirectResponse
# This must be randomly generated
RANDON_SESSION_ID = "iskksioskassyidd"
# This must be a lookup on user database
USER_CORRECT = ("admin", "admin")
# This must be Redis, Memcached, SQLite, KV, etc...
@AlexLynd
AlexLynd / reminder.py
Last active September 22, 2024 19:09
A timed Python script to send reminder emails.
# https://myaccount.google.com/lesssecureapps
import datetime as dt
from datetime import datetime
import time , smtplib
def send_email(have):
email_user = '***@gmail.com' # email here
server = smtplib.SMTP ('smtp.gmail.com', 587)
server.starttls()
server.login(email_user, '***') # pass here or read from input
message = """\