Skip to content

Instantly share code, notes, and snippets.

@stuartaccent
stuartaccent / file-uploader.component.html
Last active March 18, 2021 16:24
Angular 7 file uploader with queue and progress using HttpClient, example https://stackblitz.com/edit/angular-7-file-upload-queue
<div class="row">
<div class="col-md-3">
<h3>Select files</h3>
<input type="file" #fileInput multiple (change)="addToQueue()" />
</div>
<div class="col-md-9">
<h3>Upload queue</h3>
<table class="table-headed table-striped">
@stuartaccent
stuartaccent / filter.py
Created March 3, 2023 23:50
Fastapi, Pydantic, Sqlalchemy List filter, order, limit model
from typing import List, Optional
from accentdatabase.session import get_session
from fastapi import Depends, Query
from pydantic import BaseModel, Field
from sqlalchemy import func, or_, select
from sqlalchemy.ext.asyncio import AsyncSession
from models import Model
@stuartaccent
stuartaccent / security.py
Created March 15, 2023 12:37
Basic auth in fastapi
import secrets
from fastapi import Depends, HTTPException
from fastapi.security import HTTPBasic, HTTPBasicCredentials
from starlette import status
from app.config import settings
security = HTTPBasic()