Skip to content

Instantly share code, notes, and snippets.

View CheeseCake87's full-sized avatar
🐝
Oh look, a bee.

David CheeseCake87

🐝
Oh look, a bee.
  • Scotland
  • 23:38 (UTC +01:00)
View GitHub Profile
@CheeseCake87
CheeseCake87 / auth.py
Last active September 22, 2023 13:12
import re
import itertools
from dataclasses import dataclass
from datetime import datetime
from hashlib import sha1, sha256, sha512
from random import choice
from random import randrange
from string import punctuation, ascii_letters
@CheeseCake87
CheeseCake87 / hex_web_colors.py
Created September 7, 2022 22:19
A big list of HTML colors with their hex values
html_hex_colors = {'Black': '#000000', 'Night': '#0C090A', 'Charcoal': '#34282C', 'Oil': '#3B3131', 'Dark Gray': '#3A3B3C', 'Light Black': '#454545',
'Black Cat': '#413839', 'Iridium': '#3D3C3A', 'Black Eel': '#463E3F', 'Black Cow': '#4C4646', 'Gray Wolf': '#504A4B', 'Vampire Gray': '#565051',
'Iron Gray': '#52595D', 'Gray Dolphin': '#5C5858', 'Carbon Gray': '#625D5D', 'Ash Gray': '#666362', 'DimGray DimGrey': '#696969',
'Nardo Gray': '#686A6C', 'Cloudy Gray': '#6D6968', 'Smokey Gray': '#726E6D', 'Alien Gray': '#736F6E', 'Sonic Silver': '#757575',
'Platinum Gray': '#797979', 'Granite': '#837E7C', 'Gray Grey': '#808080', 'Battleship Gray': '#848482', 'Gunmetal Gray': '#8D918D',
'DarkGray DarkGrey': '#A9A9A9', 'Gray Cloud': '#B6B6B4', 'Silver': '#C0C0C0', 'Pale Silver': '#C9C0BB', 'Gray Goose': '#D1D0CE',
'Platinum Silver': '#CECECE', 'LightGray LightGrey': '#D3D3D3', 'Gainsboro': '#DCDCDC', 'Platinum': '#E5E4E2', 'Metallic Silver': '#BCC6CC',
@CheeseCake87
CheeseCake87 / animals.py
Created September 7, 2022 22:24
Big list of animals in a python list
animals = ['Canidae', 'Felidae', 'Cat', 'Cattle', 'Dog', 'Donkey', 'Goat', 'Horse', 'Pig', 'Rabbit',
'Aardvark', 'Aardwolf', 'Albatross', 'Alligator', 'Alpaca', 'Amphibian', 'Anaconda',
'Angelfish', 'Anglerfish', 'Ant', 'Anteater', 'Antelope', 'Antlion', 'Ape', 'Aphid',
'Armadillo', 'Asp', 'Baboon', 'Badger', 'Bandicoot', 'Barnacle', 'Barracuda', 'Basilisk',
'Bass', 'Bat', 'Bear', 'Beaver', 'Bedbug', 'Bee', 'Beetle', 'Bird', 'Bison', 'Blackbird',
'Boa', 'Boar', 'Bobcat', 'Bobolink', 'Bonobo', 'Bovid', 'Bug', 'Butterfly', 'Buzzard',
'Camel', 'Canid', 'Capybara', 'Cardinal', 'Caribou', 'Carp', 'Cat', 'Catshark',
'Caterpillar', 'Catfish', 'Cattle', 'Centipede', 'Cephalopod', 'Chameleon', 'Cheetah',
'Chickadee', 'Chicken', 'Chimpanzee', 'Chinchilla', 'Chipmunk', 'Clam', 'Clownfish',
'Cobra', 'Cockroach', 'Cod', 'Condor', 'Constrictor', 'Coral', 'Cougar', 'Cow', 'Coyote',
@CheeseCake87
CheeseCake87 / postgres-cheatsheet.md
Created March 19, 2023 19:34 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

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)
import random
import timeit
from datetime import datetime
from datetime import timedelta
from pytz import timezone
"""
pip install pytz
"""
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
#
# 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
// 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;
@CheeseCake87
CheeseCake87 / flask_file_upload_pathlib.py
Last active October 10, 2023 06:59
Flask file upload with pathlib
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="/")
@CheeseCake87
CheeseCake87 / enum_colors.py
Last active December 6, 2023 13:12
enum_colors.py
from enum import Enum
class Colors(Enum):
BLACK = '#000000'
NIGHT = '#0C090A'
CHARCOAL = '#34282C'
OIL = '#3B3131'
DARK_GRAY = '#3A3B3C'
LIGHT_BLACK = '#454545'