Skip to content

Instantly share code, notes, and snippets.

import collections
import math
import os
import cv2
import numpy as np
import time
MAX_LINES = 4000
N_PINS = 36*8
MIN_LOOP = 20 # To avoid getting stuck in a loop
@rrauenza
rrauenza / human-readable-hash-comparisons.md
Created October 1, 2020 22:27 — forked from raineorshine/human-readable-hash-comparisons.md
An aesthetic comparison of a few human-readable hashing functions.

An Aesthetic Comparison of Human-Readable
Hashing Functions

The following compares the output of several creative hash functions designed for human readability.

sha1's are merely used as arbitrary, longer, distributed input values.

input 1 word output 2 word output 3 word output
@rrauenza
rrauenza / btrfs-smr-balance.py
Created May 5, 2020 14:07 — forked from dvanders/btrfs-smr-balance.py
btrfs-smr-balance.py
#!/usr/bin/env python3
# The goal of this is to gradually balance a btrfs filesystem which contains DM-SMR drives.
# Such drive are described in detail at https://www.usenix.org/node/188434
# A normal drive should be able to balance a single 1GB chunk in under 30s.
# Such a stripe would normally be written directly to the shingled blocks, but in the case
# it was cached, it would take roughly 100s to clean.
# So our heuristic here is:
@rrauenza
rrauenza / models.py
Created July 5, 2018 22:57 — forked from zorainc/models.py
Django model fields for big integer support for primairy and foreign keys
class BigForeignKey(models.ForeignKey):
def db_type(self, connection):
""" Adds support for foreign keys to big integers as primary keys.
"""
rel_field = self.rel.get_related_field()
if (isinstance(rel_field, BigAutoField) or
(not connection.features.related_fields_match_type and
isinstance(rel_field, (BigIntegerField, )))):