Skip to content

Instantly share code, notes, and snippets.

View meepoSenpai's full-sized avatar
🥐
Crossn't

Ian meepoSenpai

🥐
Crossn't
View GitHub Profile
@meepoSenpai
meepoSenpai / demo.py
Created March 19, 2021 07:00
FastAPI oAuth Demonstration
# Entire auth.py for the Auth Routes
import jwt
from fastapi import APIRouter, Depends
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from ..models import User
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="auth")
jwt_secret = "somerandomjwtsecret"
router = APIRouter(
@meepoSenpai
meepoSenpai / user.py
Created March 11, 2021 17:34
User Stuff
class User(DB.Entity):
id = PrimaryKey(int, auto=True)
name = Required(str)
mail = Required(str)
passhash = Required(str)
@db_session
def create(username: str, email: str, passhash: str):
if username == None or passhash == None or email == None:
raise ValueError("Username, E-Mail or Password can't be None")
[unique_partners.update([supplier.name for supplier in supplier_info]) for supplier_info in [line.product_id.seller_ids for line in self.order_lines if line.product_id and line.product_id.seller_ids]]
# This small snippet does the exact same task as the following:
for line in self.order_lines:
if line.product_id and line.product_id.seller_ids:
for supplier_info in line.product_id.seller_ids:
unique_partners.update([supplier.name for supplier in supplier_info])
import unittest
from hamming_code import HammingCode, HCResult
from stack_machine import StackMachine, SMState
class TestHammingDecoder(unittest.TestCase):
def setUp(self):
self.hc = HammingCode()
@meepoSenpai
meepoSenpai / .Xresources
Last active November 6, 2016 03:41
Dotfiles
*color0: #201d1f
*color1: #a0929a
*color2: #a0949d
*color3: #a0969c
*color4: #a0989e
*color5: #a0989c
*color6: #a0989d
*color7: #a09a9e
*color8: #888587
*color9: #c8c5c6
@meepoSenpai
meepoSenpai / fancy-lock.sh
Created December 15, 2015 21:49
Fancy Lockscreen script
#!/bin/bash
# Dependencies:
# imagemagick
# i3lock-color-git
# scrot
IMAGE=/tmp/i3lock.png
# All options are here: http://www.imagemagick.org/Usage/blur/#blur_args
@meepoSenpai
meepoSenpai / dictlist.py
Created November 12, 2015 20:44
dictlist
def addtolistindict(key, comparelist,dictlist):
for elem in comparelist:
if elem[0] == key:
dictlist.append(elem[1])
#Man, sieht,dass das ganze Strings an Listen in einem Dictionary anhängen soll
# In etwa so:
comparelist = [['A', 2],['B',3]]
somedict = {'A':[],'B':[]}
@meepoSenpai
meepoSenpai / Xresources
Last active August 29, 2015 14:18
Dotfiles
urxvt*termName: rxvt
urxvt*background: rgba:2000/2000/2000/ddff
urxvt*depth: 32
urxvt*foreground: #949494
urxvt*scrollBar: false
urxvt*matcher.button: 1
urxvt*cursorBlink: true
urxvt*cursorColor: #c1c8c9
urxvt*colorBD: #9a7b88
@meepoSenpai
meepoSenpai / .Xresources
Created March 20, 2015 21:37
XResources
urxvt*termName: rxvt
urxvt*background: rgba:2000/2000/2000/ddff
urxvt*depth: 32
urxvt*foreground: #949494
urxvt*scrollBar: false
urxvt*matcher.button: 1
urxvt*cursorBlink: true
urxvt*cursorColor: #c1c8c9
urxvt*colorBD: #9a7b88
min_js = open('min.js', 'r')
max_js = open('max.js', 'w')
min_js_str = min_js.read()
indent_counter = 0
help_string = ""
for character in min_js_str:
if character == '{':