Skip to content

Instantly share code, notes, and snippets.

uv pip compile dev-requirements.in requirements.in > dev-requirements.txt
uv pip compile requirements.in > requirements.txt
uv pip sync dev-requirements.txt requirements.txt
@nilleb
nilleb / impots.py
Last active January 3, 2024 13:39
Impôts sur le revenu et impôt sur les sociétés, comparaison
baremes = [(0, 10777, 0), (10778, 27478, 11), (27479, 78570, 30), (78571, 168994, 41)]
max_bareme, max_pct = 168995, 45
def impot_revenu(val, nombre_parts=1):
val = val - val * 0.1
val = val / nombre_parts
impot = 0
for min_bareme, max_bareme, pct in baremes:
montant_imposable = max(
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2016 Matt Menzenski
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@nilleb
nilleb / en.json
Last active August 10, 2023 07:23
cli to help the wordle player solve today's puzzle
["which", "there", "their", "about", "would", "these", "other", "words", "could", "write", "first", "water", "after", "where", "right", "think", "three", "years", "place", "sound", "great", "again", "still", "every", "small", "found", "those", "never", "under", "might", "while", "house", "world", "below", "asked", "going", "large", "until", "along", "shall", "being", "often", "earth", "began", "since", "study", "night", "light", "above", "paper", "parts", "young", "story", "point", "times", "heard", "whole", "white", "given", "means", "music", "miles", "thing", "today", "later", "using", "money", "lines", "order", "group", "among", "learn", "known", "space", "table", "early", "trees", "short", "hands", "state", "black", "shown", "stood", "front", "voice", "kinds", "makes", "comes", "close", "power", "lived", "vowel", "taken", "built", "heart", "ready", "quite", "class", "bring", "round", "horse", "shows", "piece", "green", "stand", "birds", "start", "river", "tried", "least", "field", "whose", "girls", "leave
@nilleb
nilleb / proxy.py
Created July 11, 2022 19:12
CORS proxy
# -*- coding: utf-8 -*-
# forwards the calls to http://localhost:8000/https://google.com to https://google.com - copying the headers, query strings, etc
from fastapi import FastAPI, Request, Response
from fastapi.middleware.cors import CORSMiddleware
import requests
app = FastAPI()
@nilleb
nilleb / README.md
Last active January 6, 2018 13:33
Hack: use google-cloud-spanner in a google-app-engine app
@nilleb
nilleb / relengprinciples.md
Last active May 18, 2017 19:40
Release engineering principles

This documents details my release engineering principles. They have been forged through experience, no need to say. :-)

The context is: you want to build your software, and eventually distribute it. You are not alone, and even if, you're not immortal. If you want your creation to live after you,

You need

  • An objective, repeatable, exhaustive process.
    • No hidden knowledge.
    • No environmental prerequisites.
  • In three years, you should be able to get the same binaries you get today.
for /f %%i in ('git rev-parse --abbrev-ref HEAD| sed "sI.*/IIg"') do set branch=%%i
git show-branch 2> nul | grep '\*' | grep -v "%branch%" | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'
# How it works:
# 1| Display a textual history of all commits.
# 2| Ancestors of the current commit are indicated
# by a star. Filter out everything else.
# 3| Ignore all the commits in the current branch.
# 4| The first result will be the nearest ancestor branch.
@nilleb
nilleb / gist:7baab45de966c3f0b750
Last active December 7, 2016 20:48
git-2.3.5 windows sspi
K:\temp>set GIT_CURL_VERBOSE=1
K:\temp>rm -rf Repository
K:\temp>git clone http://:@server:8080/tfs/COLLECTION/TeamProject/_git/Repository
11:51:47.940501 git.c:348 trace: built-in: git 'clone' 'http://:@server:8080/tfs/COLLECTION/TeamProject/_git/Repository'
Clonage dans 'Repository'...
11:51:48.024602 run-command.c:351 trace: run_command: 'git-remote-http' 'origin' 'http://:@server:8080/tfs/COLLECTION/TeamProject/_git/Repository'
* Couldn't find host server in the _netrc file; using defaults
* timeout on name lookup is not supported
@nilleb
nilleb / gist:6e40ed16259e5a0b72e1
Created April 14, 2015 09:58
git-1.9.5 windows sspi
K:\temp>set GIT_CURL_VERBOSE=1
K:\temp>git clone http://:@server:8080/tfs/COLLECTION/TeamProject/_git/Repository
Cloning into 'Repository'...
* Couldn't find host server in the _netrc file; using defaults
* Adding handle: conn: 0x39c790
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x39c790) send_pipe: 1, recv_pipe: 0