Skip to content

Instantly share code, notes, and snippets.

View vovavili's full-sized avatar
🎯
Focusing

Vladimir vovavili

🎯
Focusing
  • Paris, France
View GitHub Profile
@GhostofGoes
GhostofGoes / pyproject.toml
Last active November 27, 2025 19:32
Example pyproject.toml
# This example pyproject.toml is for a basic pip+setuptools setup.
# If you use a project management tool (like Poetry), then
# those tools will have slightly different configurations or additions.
# I highly recommend using a project management tool for your project.
# Project management is a highly opinionated subject.
# There are a lot of good, robust tools in this space now (as of 2023)
# Two that I've used and recommend are Poetry and PDM.
# Poetry is more mature, PDM is recent, both work well.
# - Poetry: https://python-poetry.org/
@ZhennanWu
ZhennanWu / README.md
Last active July 17, 2025 13:17
Rayon vs async threadpool benchmarks

The following are the benchmark results for parallel speedup of rayon, tokio, and async-std on a 16-thread machine. (Core i7-12700K big core only, Gentoo Linux)

How to intepret the results

  1. The input variable is the "Available parallelism", e.g. how many parallel work units are spawned at the same time.
  2. The measured time is from the start of the work unit spawning to the end of the last work unit.
  3. Before and after each iteration, the threadpool is always empty.
  4. Hence the low parallelism results should be intepreted as "the runtime latency of a burst workload"

Work unit types

  1. "light": 10 random uncached memory read.
@yamgarcia
yamgarcia / move.ps1
Last active October 28, 2025 15:23
Auto Mouse Mover - AntiscreenSaver
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class Mouse {
[DllImport("user32.dll")]
public static extern bool SetCursorPos(int x, int y);
}
"@
function Start-AntiscreenSaver {
@hofrob
hofrob / dict_perf.py
Last active September 24, 2024 10:21
Compare timings of dict constructor with literal dict
import random
import string
import time
values = []
for i in range(10):
values.append("".join(random.choices(string.ascii_letters + string.digits, k=10)))
n = 500000
print(f"Construct {n=} dicts with these random values: {values=}")
@vovavili
vovavili / time_script.py
Last active August 30, 2024 10:10
Time Python scripts
"""Time functions using a decorator."""
import time
from collections.abc import Callable
from functools import wraps
def time_function[**P, R](func: Callable[[P], R]) -> Callable[[P], R]:
"""
Time functions using a decorator.
@nymous
nymous / README.md
Last active November 14, 2025 12:05
Logging setup for FastAPI, Uvicorn and Structlog (with Datadog integration)

Logging setup for FastAPI

This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.

Then, you can use Structlog loggers or standard logging loggers, and they both will be processed by the Structlog pipeline (see the hello() endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!

Requests are assigned a correlation ID with the asgi-correlation-id middleware (either captured from incoming request or generated on the fly). All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented. This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog. You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom

# -*- coding: utf-8 -*-
import os
from html.parser import HTMLParser
import dash
import pandas as pd
import plotly.express as px
import requests
from dash import html, dcc, dash_table, Input, Output