Skip to content

Instantly share code, notes, and snippets.

import re
from enum import Enum
from typing import Annotated, Any
from fastapi import FastAPI, Query
from pydantic import BaseModel, field_validator
_CAMEL_BOUNDARY = re.compile(r"(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])")
# lowerCamelCase only: no underscores, no leading capital
_CAMEL_SHAPE = re.compile(r"^[a-z][a-zA-Z0-9]*$")
@c6401
c6401 / gist:710b49f85a7183bb7bdf4d927357dbbf
Last active July 25, 2026 16:36
test_vim_transparent_gpg.vimrc
augroup encrypted
autocmd!
autocmd BufReadPre,BufWritePre *.gpg,*.asc
\ setlocal binary noswapfile noundofile nobackup nowritebackup | set viminfo=
autocmd BufReadPost *.gpg,*.asc
\ silent execute '%!gpg -qd 2>/dev/null' | setlocal nobinary | filetype detect
autocmd BufWritePre *.gpg,*.asc
\ silent execute '%!gpg -qc --cipher-algo AES256 2>/dev/null'
autocmd BufWritePost *.gpg,*.asc
\ silent undo | setlocal nobinary
#!/usr/bin/env -S uv run --with=pyyaml --with=jinja2 --with=fire python
#s.py
# python -mfire s.py
# type: ignore
from jinja2 import Template
from functools import wraps
def _clip():
from tkinter import Tk
tk = Tk()
@c6401
c6401 / snippets.py
Last active October 2, 2017 00:13
Various python snippets
"""
The MIT License (MIT)
Copyright (c) 2016, Ruslan Zhenetl
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is