Skip to content

Instantly share code, notes, and snippets.

View cav71's full-sized avatar

Antonio Cavallo cav71

View GitHub Profile
# uv run https://gist.github.com/cav71/c2918b177bcddb782116b7867ae12bc5/raw
# /// script
# dependencies = [
# "schwifty",
# "fastapi[standard]",
# "uvicorn",
# ]
# ///
# https://docs.developer.swift.com/docs/api-guides/swiftref-api/swiftref-api-reference#tag/account_numbers/operation/getAccountNumberValidity
# use:
# 1. prepare the json input for gemini
# routings_py dump-json-input | pbcopy
# 2. feed the AI with a prompt:
# > You are an expert data transformation engine. Your task is to convert an input JSON list into a new JSON list based on a set of specific rules.
# > The input data is
# ```json
# [PUT HERE THE 1. output
# > convert the second element of each row using the correct capitalization for the company name.
# 3. save the json output somewhere
@cav71
cav71 / lister.py
Created July 30, 2025 19:10
common addresses fields
#!/usr/bin/env python3
# Usage:
# git clone https://github.com/OpenCageData/address-formatting.git
# ./lister.py IN CH CA MX HK
from __future__ import annotations
import argparse
import sys
from pathlib import Path
from typing import Any
import yaml
#!/usr/bin/env -S uv run --no-project
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "textual"
# ]
# ///
import argparse
from pathlib import Path
#!/opt/venvs/ops/bin/python3
import argparse
from pathlib import Path
def app(notes: dict[str, list[str]]):
from textual.app import App, ComposeResult
from textual.widgets import Collapsible, Footer, Label, Markdown
@cav71
cav71 / crashme.py
Last active April 14, 2025 18:52
crash python interpreter
import sys
import threading
import random
import time
import ctypes
def core(i: int, abort: int) -> None:
time.sleep(random.randint(1,10)*0.1)
while True:
class parametric(object):
@property
def name(self):
return '{0}_{1}'.format(self.fn.__name__, self.index)
def __init__(self, fn, spec, index, arg):
self.fn, self.spec, self.index, self.arg = fn, spec, index, arg
#self.__call__.__doc__ = self.fn.__doc__
#self.__call__.__name__ = self.fn.__name__