Skip to content

Instantly share code, notes, and snippets.

View maciej's full-sized avatar

Maciej Biłas maciej

View GitHub Profile
@maciej
maciej / collision.py
Last active January 21, 2021 13:41 — forked from zadam/collision.py
Calculate birthday paradox (chance of collision) for very large numbers
#!/usr/bin/python
# This is used for calculating of birthday paradox for large values
# We're using approximation explained here: http://preshing.com/20110504/hash-collision-probabilities/
# Beware that approximation isn't very precise at smaller params N and K, but gets more precise with large numbers
# see https://docs.python.org/3/library/decimal.html#module-decimal
from decimal import *
# setting decimal precision
@maciej
maciej / transfer.fish
Last active December 6, 2016 10:58 — forked from nl5887/transfer.fish
Bash and zsh alias for transfer.sh. Transfers files and directories to transfer.sh.
function transfer
if test (count $argv) -eq 0
echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
end
## get temporarily filename, output is written to this file show progress can be showed
set tmpfile ( mktemp -t transferXXX )
## upload stdin or file