Skip to content

Instantly share code, notes, and snippets.

View cezarmezzalira's full-sized avatar

Cezar Augusto Mezzalira cezarmezzalira

View GitHub Profile
@cezarmezzalira
cezarmezzalira / manutencao_routes.py
Last active December 10, 2023 14:17
SINF4NA - Exame final 2023
from fastapi import APIRouter
from fastapi.responses import JSONResponse
from sqlmodel import select
from src.config.database import get_session
from src.models.manutencao_model import Manutencao
manutencao_router = APIRouter(prefix="/manutencoes")
@cezarmezzalira
cezarmezzalira / provas_routes.py
Created November 21, 2023 13:03
RACE route files
from fastapi import APIRouter
from src.models.provas_model import Provas
from src.config.database import get_session
provas_router = APIRouter(prefix="/provas")
@provas_router.post("")
def cria_prova(prova: Provas):
with get_session() as session:
@cezarmezzalira
cezarmezzalira / provas_model.py
Created November 21, 2023 12:50
RACE API Models
from typing import List
from sqlmodel import Field, Relationship, SQLModel
class Provas(SQLModel, table=True):
id: int = Field(default=None, primary_key=True)
descricao: str
data_prova: str
q1: str
@cezarmezzalira
cezarmezzalira / database.py
Last active November 21, 2023 12:45
SQLModel database configuration example
from contextlib import contextmanager
from sqlmodel import Session, SQLModel, create_engine
PG_USERNAME = "root"
PG_PASSWORD = "postgres"
PG_HOST = "localhost"
PG_PORT = 54322
PG_DATABASE = "race_db"
@cezarmezzalira
cezarmezzalira / settings.json
Last active February 28, 2023 02:50
Visual Studio Code - Settings
{
// "workbench.colorTheme": "Monokai Dark Soda",
"workbench.startupEditor": "none",
"workbench.editor.enablePreview": false,
"workbench.editor.labelFormat": "short",
"workbench.editor.revealIfOpen": true,
"telemetry.telemetryLevel": "off",
"security.workspace.trust.enabled": false,
"editor.hover.above": false,
"editor.guides.bracketPairs": true,
@cezarmezzalira
cezarmezzalira / 53-zap.conf
Created December 26, 2022 14:56
Disable XOrg kill shortcut - Replace /usr/share/X11/xorg.conf.d/53-zap.conf
Section "ServerFlags"
Option "DontZap" "on"
EndSection
Section "InputClass"
Identifier "Keyboard Defaults"
MatchIsKeyboard "yes"
Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection