Just random approximations sometimes useful in work for "mental" calculation.
b(p) ≈ 1.44 * log₂(p)
b— bits per elementp— false positive probability
| #!/usr/bin/env python3 | |
| from subprocess import check_output | |
| from json import loads | |
| from time import sleep | |
| from datetime import datetime | |
| class Stats: | |
| def __init__(self): | |
| self.min = float('inf') |
| /* | |
| count = 10000000 | |
| len = 512 | |
| name min max spent (s) | |
| ---- --- --- ---- | |
| fnv 19525 19537 2.417305 | |
| fx 19531 19532 0.48344 |
| #!/bin/sh | |
| RUST=~/builds/pi-rust | |
| TOOLCHAIN=~/builds/pi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64 | |
| LINKER=arm-linux-gnueabihf-gcc | |
| # Rust uses `cc` as linker. | |
| if [ ! -f "$TOOLCHAIN/bin/cc" ]; then |
| /* Usage: | |
| * int *nums = new_vec(int); | |
| * | |
| * vec_push(&nums, 1); | |
| * vec_push(&nums, 5); | |
| * | |
| * for (int i = 0; i < vec_len(nums); ++i) | |
| * printf("%d", nums[i]); | |
| * | |
| * Advanced usage: |
| #!/bin/bash | |
| # ovrload.ru file uploader | |
| # ovrload — former troloload | |
| VERSION='v0.1.3' | |
| URL='http://ovrload.ru' | |
| SHORTER_URL='http://tinyurl.com' | |
| FAILURES=0 # number of upload fails | |
| LONGTIME=0 # whether to make long-time links |