Skip to content

Instantly share code, notes, and snippets.

Python Abstraction and Complexity Guidelines

High Scrutiny

These constructs change how behavior is discovered or resolved at runtime and therefore require strong justification:

  • ABC
  • @abstractmethod
  • inheritance
  • Protocol
@fclesio
fclesio / vrt-apex-2026.md
Last active August 7, 2026 16:00
Liga VRT — Regulamento do campeonato VRT Apex 2026 (Assetto Corsa Competizione)

📅 Calendário

As corridas acontecem quinzenalmente, às terças-feiras, com largada às 20h30, nas seguintes pistas do jogo base.

Etapa Data Pista País
1 terça, 25/08/2026 Misano World Circuit 🇮🇹
@fclesio
fclesio / stress_test.py
Created September 10, 2025 05:20
Scaffolding for a simple stress test
import json
import random
from locust import HttpUser, task, between, events
from locust.exception import LocustError
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--api-url", type=str, default="https://parallelum.com.br/fipe/api/v1/carros/marcas",
help="Full API endpoint URL to test (e.g., for brands)")
parser.add_argument("--request-body", type=str, default="{}",
def transform_timestamp_to_features(timestamp):
# Convert timestamp to datetime
dt = pd.to_datetime(timestamp)
# Initialize a dictionary to store features
features = {}
# Date Features
features["year"] = dt.year
features["quarter"] = dt.quarter
• Installing prophet (1.1.3): Failed
ChefBuildError
Backend subprocess exited when trying to invoke build_wheel
running bdist_wheel
running build
running build_py
creating build
@fclesio
fclesio / darts-install-m1.sh
Last active July 14, 2023 12:32
Sequence to Install Darts in MacBook M1 - OS: MacOS Ventura
$ conda install -c conda-forge pip
$ conda install -c conda-forge 'lightgbm>=3.3.3'
$ conda install -c conda-forge cmdstan
$ export PROPHET_REPACKAGE_CMDSTAN=False
$ export PRECOMPILED_HEADERS=false
@fclesio
fclesio / multi-container-pod-cloud-sql-proxy.yaml
Created November 1, 2022 15:29
Sidecar container to connect to Google CloudSQL via Proxy
apiVersion: v1
kind: Pod
metadata:
name: test-proxy-deploy
spec:
volumes:
- name: secret-volume
secret:
secretName: cloud_sql_key_secret
containers:
[
{
"Id":"value",
"prediction":"value",
"status-code":200
}
]
@fclesio
fclesio / text_classification_logging_payload.json
Last active September 15, 2022 14:34
Generic json template for ML APIs for a Text Classification
{
"message":"OK",
"method":"POST",
"status-code":200,
"timestamp":"2022-01-01T00:00:00.000000",
"url":"http://0.0.0.0:1201/predict",
"data":{
"prediction":[
{
"input_text":"Flash crashes is a scenario where the price of stocks plunges but then quickly recovers.",
# Importação da biblioteca do Boto3 e
# criação de sessão para acesso aos recursos
import boto3
sessao_boto = boto3.Session(region_name='us-east-1')
# Função para pegar a "ROLE" (papel) de execução
# IAM dos recursos no Sage Maker
from sagemaker import get_execution_role
ROLE = get_execution_role()