This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tcp-keepalive 0 | |
tcp-backlog 65536 | |
slave-serve-stale-data yes | |
slave-read-only yes | |
maxclients 10000 | |
maxmemory 8589934592 | |
rdbcompression no | |
rdbchecksum no | |
appendonly no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass, field, asdict | |
@dataclass | |
class Schedule: | |
id: int | |
name: str | |
@dataclass | |
class Company: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A: | |
attr =1 | |
a = A() | |
# a.attr (1) | |
def test(a): | |
a.attr = 2 | |
test(a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import httpx | |
import uvicorn | |
from starlette.applications import Starlette | |
from starlette.background import BackgroundTasks | |
from starlette.responses import JSONResponse | |
from starlette.routing import Route | |
client = httpx.AsyncClient() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
import re | |
log_entry_pattern = re.compile(r"\bSRC=([\d.]+)\b") | |
def parse_log(log_file): | |
src_ip_counts = defaultdict(int) | |
with open(log_file, "r") as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from concurrent.futures import ProcessPoolExecutor | |
from contextlib import asynccontextmanager | |
from typing import TYPE_CHECKING | |
from time import time | |
from fastapi import FastAPI | |
@asynccontextmanager | |
async def lifespan(app: "FastAPI"): |