Skip to content

Instantly share code, notes, and snippets.

View hclivess's full-sized avatar
🏠
Working from home

Jan Kučera hclivess

🏠
Working from home
View GitHub Profile
import select, json, os
def send(sdef, data, slen):
sdef.setblocking(0)
sdef.sendall(str(len(str(json.dumps(data)))).encode("utf-8").zfill(slen))
sdef.sendall(str(json.dumps(data)).encode("utf-8"))
if "posix" not in os.name:
def receive(sdef, slen):

Keybase proof

I hereby claim:

  • I am hclivess on github.
  • I am hclivess (https://keybase.io/hclivess) on keybase.
  • I have a public key ASBud6ucwCC-wivAMdyX2A9osx6urTdQemc_yftjnb8mjgo

To claim this, I am signing this object:

@hclivess
hclivess / tezos-baking-howto.md
Created July 14, 2018 09:21 — forked from dakk/tezos-baking-howto.md
tezos-baking-howto.md

Tezos baking howto

This howto is valid both for Betanet.

Setup

Prereq

You need gcc, m4, git, unzip, rsync and curl. In debian / ubuntu run:

# c = hyperblock in ram OR hyperblock file when running only hyperblocks
# h = ledger file
# h2 = hyperblock file
# h3 = ledger file OR hyperblock file when running only hyperblocks
# never remove the str() conversion in data evaluation or database inserts or you will debug for 14 days as signed types mismatch
# if you raise in the server thread, the server will die and node will stop
# never use codecs, they are bugged and do not provide proper serialization
# must unify node and client now that connections parameters are function parameters
# if you have a block of data and want to insert it into sqlite, you must use a single "commit" for the whole batch, it's 100x faster
@hclivess
hclivess / tezos-rolling.md
Last active February 18, 2020 07:05
Tezos Rolling Mode Guide (How To)

Tezos Rolling Mode Guide (How To)

Running Tezos in this mode will only store the blocks after latest snapshot, no longer requiring hundreds of gigabytes of drive storage space.

The software modification is provided by Nomadic Labs, details: https://blog.nomadic-labs.com/introducing-snapshots-and-history-modes-for-the-tezos-node.html

Upgrade only:

rm -rf tezos
wget https://gitlab.com/nomadic-labs/tezos/-/archive/mainnet-snapshots/tezos-mainnet-snapshots.zip
unzip tezos-mainnet-snapshots.zip
@hclivess
hclivess / veriblock_scam
Created March 29, 2019 07:12
veriblock is a CIA scam
from blockchain import blockexplorer
from difflib import SequenceMatcher
def similar(a, b):
return SequenceMatcher(None, a, b).ratio()
def compare (forked_shitcoin_hashes):
winner = None
shitcoin_race_winner = 0
@hclivess
hclivess / tornador.py
Created June 5, 2019 23:10
Tornado Web Background Thread (using separately updated object)
import json
import tornado.ioloop
import tornado.web
import dator
import threading
import time
class MainHandler(tornado.web.RequestHandler):
def initialize(self, updater):
self.updater = updater
del /f /s /q dist 1>nul
rmdir /s /q dist
mkdir dist
python -m nuitka --follow-imports wallet.py --windows-icon=graphics\icon.ico --standalone --show-progress -j 8 --recurse-all --include-package=coincurve --plugin-enable=tk-inter
robocopy wallet.dist dist\files /MOVE /E
robocopy "C:\Program Files\Python37\Lib\site-packages\Cryptodome" "dist\files\Cryptodome" /MIR
robocopy "C:\Program Files\Python37\Lib\site-packages\coincurve" "dist\files\coincurve" /MIR
@hclivess
hclivess / solar_panel.py
Last active June 24, 2019 17:29
calculates kilowatthour production in a month based on pannel wattage and solar radiation
#calculates kilowatthour production in a month based on pannel wattage and solar radiation
solar_radiation = 4.9
panel_wattage = 330
wh = solar_radiation * panel_wattage
kwh = wh / 1000
kwd_month = kwd * 28
print (f"watt_hour {wh}")
@hclivess
hclivess / digest.py
Created June 29, 2019 19:31
digest improvement proposal
import hashlib
import os
import sys
import essentials
import mempool as mp
import mining
import mining_heavy3
import staking
from difficulty import *