Skip to content

Instantly share code, notes, and snippets.

View humanely's full-sized avatar

Prabhat humanely

View GitHub Profile
@gavinandresen
gavinandresen / UTXO_Cuckoo.md
Last active June 7, 2021 17:45
Using a cuckoo filter for fast 'unspent?' lookups

A "Cuckoo Filter" is a nifty data structure invented a few years ago; read the paper for details.

Like a Bloom filter, you insert items and then can later ask "does this item exist in the filter?" You'll get either a definite "no" or "yes, probably" with some false-positive error rate. Cuckoo filters have two advantages over Bloom filters:

  1. They are more space efficient at false positive rates less than about 0.03.
  2. You can delete items from them without affecting the false positive rate at all.

It seems to me that an in-memory cuckoo filter could work really well to keep track of Bitcoin's "unspent transaction output set" (UTXO set), to make transaction (or block) validation as fast as possible using minimal memory or disk.

Recall that Bitcoin transactions (other than coinbase transactions that create new coins) have inputs that refer to unspent outputs. An input refers to a previous output by giving the transaction id (a 32-byte hash) co

M590 introduction

AT serial commands

A successful connection is initialized in this way:

➟  sudo picocom -b 115200 /dev/ttyUSB0 
picocom v1.7
@micahstubbs
micahstubbs / .block
Last active January 2, 2017 20:24
Sankey Particles with only inline styles
license: CC0-1.0
@johntyree
johntyree / history_vol.py
Last active February 26, 2020 04:24
Calculate annualized volatility from historical data.
#/usr/bin/env python
from pandas import np
from pandas.io.data import DataReader
def historical_volatility(sym, days):
"Return the annualized stddev of daily log returns of `sym`."
try:
quotes = DataReader(sym, 'yahoo')['Close'][-days:]
@henrik
henrik / ocr.markdown
Created March 3, 2012 17:07
OCR on OS X with tesseract

Install ImageMagick for image conversion:

brew install imagemagick

Install tesseract for OCR:

brew install tesseract --all-languages

Or install without --all-languages and install them manually as needed.