Skip to content

Instantly share code, notes, and snippets.

View hasansezertasan's full-sized avatar
🏠
Working from home

Hasan Sezer Taşan hasansezertasan

🏠
Working from home
View GitHub Profile
@dunossauro
dunossauro / app.py
Created May 12, 2021 12:52
Flask 2.0 async support + SQLAlchemy 1.4 async ORM
from flask import Flask, request
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
from sqlalchemy.future import select
from sqlalchemy.orm import declarative_base, sessionmaker
engine = create_async_engine('sqlite+aiosqlite:///./db.db')
async_session = sessionmaker(
engine, expire_on_commit=False, class_=AsyncSession
)
@infinex
infinex / fastapi_ap_scheduler.py
Last active September 21, 2024 10:36
python utils
from datetime import datetime, time
# FastAPI and Pydantic Related Libraries
from time import sleep
from apscheduler.events import EVENT_JOB_ERROR
from fastapi import FastAPI
from pydantic import BaseModel, Field
from typing import List
from typing import List
import queue
from fastapi import FastAPI, WebSocket, WebSocketDisconnect
from fastapi.responses import HTMLResponse
from apscheduler.schedulers.asyncio import AsyncIOScheduler
app = FastAPI()
app.queue_system = queue.Queue()
app.queue_limit = 5
@Gabri
Gabri / dockerCommands.md
Last active April 6, 2023 03:28
[Docker] docker commands #docker

Docker

Command utility tools

ctop lazydocker

Rimuovere immagini non più usate

docker image prune -f

Pulizia di dati non più utilizzati (images, container, networks)

docker system prune --all --force

# routes
from fastapi import APIRouter, Depends, HTTPException
from starlette.status import HTTP_201_CREATED
from starlette.responses import JSONResponse
from sqlalchemy.orm import Session
from app.core.config import WPS_PROCESS_LINK
from app import crud
from app.api.utils.db import get_db
from app.models.job import (
@bradtraversy
bradtraversy / docker_wordpress.md
Last active November 17, 2024 13:34
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@miratcan
miratcan / annotated_turkish_syllables.py
Last active February 12, 2024 23:21
Python'da Türkçe Heceleme Yapma
def get_syllables(word):
syllables = []
"""
Aşağıdaki satır gelen kelimenin ünlü harfler 1, ünsüzler 0 olacak
şekilde desenini çıkarır.
Örneğin: arabacı -> 1010101, türkiye -> 010010
"""
@EvgenyOrekhov
EvgenyOrekhov / Docker Compose files for PHP development.md
Last active April 16, 2024 18:03
Simple Docker Compose files for PHP development

Simple Docker Compose files for PHP development

Apache + PostgreSQL + MySQL

docker-compose -f docker-compose.apache.yml up

nginx + Apache + PostgreSQL + MySQL

docker-compose -f docker-compose.nginx+apache.yml up

nginx + PHP-FPM + PostgreSQL + MySQL

docker-compose -f docker-compose.nginx+php-fpm.yml up

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE