Skip to content

Instantly share code, notes, and snippets.

@flux627
flux627 / token_bucket.py
Last active September 6, 2019 14:03
Python implementation of token bucket, segmented by unique IDs
from time import time, sleep
from collections import defaultdict
from threading import Lock
class TokenBucket:
"""
An implementation of the token bucket algorithm.
"""
def __init__(self, capacity, rate, min_interval=0):
@flux627
flux627 / invoke.sh
Created February 8, 2017 18:51
Bash function to help save typing when invoking Serverless service functions from the command line
# Invoke serverless service
invoke() {
#
# Usage:
# $ invoke stage function_name [payload_name]
#
if [ "${1}" == "local" ]; then
stage="local"
else
stage="-s ${1}"
@flux627
flux627 / bitshares-recover.md
Created May 3, 2017 14:17
Recovering bitshares 1.0 funds (extracted from archive.org)

Recover Funds

The purpose of this article is to help early users recover funds that seem to be lost due to

  • software bugs that made the keyring loose keys
  • inconvinient backup solutions
  • having the same wallet used on several machines

As long as you kept at leat one backup (including your passphrase) you are able to recover your keys and no funds are lost

@flux627
flux627 / decent-mac-error.txt
Created August 13, 2017 17:08
DECENT gets stuck on this in an infinite loop.
397877ms th_a fork_database.cpp:66 push_block ] Pushing block to fork database that failed to link: 00062d87b15787f635d46f371be75a48611042a4, 404871
397877ms th_a fork_database.cpp:67 push_block ] Head: 404727, 00062cf71ed634e0dc5889813ea39176c7a1a648
397877ms th_a application.cpp:528 handle_block ] Error when pushing block:
3080000 unlinkable_block_exception: unlinkable block
block does not link to known chain
{}
th_a fork_database.cpp:87 _push_block
{"new_block":{"previous":"00062d863db2f25d53500f34eed03d1d44848d45","timestamp":"2017-07-25T11:08:35","miner":"1.4.66","transaction_merkle_root":"0000000000000000000000000000000000000000","extensions":[],"miner_signature":"207ddf500d0cb233681f29c1fc3fe234e55c9741d08e414494173e887b013b8874788e6b68230f21eb6ecc0b0928d3107fae9b0647d14b87152fd6814c2d474df6","transactions":[]}}
th_a db_block.cpp:232 _push_block