Skip to content

Instantly share code, notes, and snippets.

View evd0kim's full-sized avatar

Ilya Evdokimov evd0kim

  • Citizen of the World
View GitHub Profile

To make automated tests work in Idea:

  1. Download https://github.com/ACINQ/eclair/commit/98bb7be70a4fc96242409b90fbf1ec9c5ff470e6 (latest release).
  2. Compile Eclair with $ '/home/anton/apache-maven-3.6.3/bin/mvn' install -DskipTests (things need to be done this way to get eclair-tests jar file which is not included in prebuilt download package).
  3. Download https://github.com/btcontract/plugin-hosted-channels.
  4. Create a folder <HC>/lib/
  5. Go to <Eclair> folder with compiled stuff.
  6. Copy <Eclair>/eclair-core/target/eclair-core_2.13-0.5.1-tests.jar to <HC>/lib/.
  7. Unpack <Eclair>/eclair-node/target/eclair-node-0.5.1-98bb7be-bin.zip, copy all <UNPACKED>/lib/*.jar to <HC>/lib/.
  8. Open HC in Idea, go to File -> Project structure -> Modules -> Dependencies.
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
# Set default figure size.
plt.rcParams['figure.figsize'] = (8, 5)
plt.style.use('dark_background')
btc_df = pd.read_csv("./data/csv/btc.csv",
@evd0kim
evd0kim / key_space.py
Created September 16, 2020 13:49
Password strength
#python
from math import log
fact = lambda n: n*fact(n-1) if n > 1 else 1
print("MEDIUM: length == 8 && sawUpper && sawLower && sawDigit")
length = 8
symbols = 26 + 26 + 10
key_space = fact(symbols)/fact(symbols - length)
print(f"\tkeyspace exponent: {log(key_space, 2)}")
@evd0kim
evd0kim / 1_to_2.py
Created August 10, 2020 15:38
Coinflips
"""
reused code from https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers
"""
import numpy as np
from matplotlib import pyplot as plt
import scipy.stats as stats
dist = stats.beta
@evd0kim
evd0kim / log_handler_slack.py
Created April 9, 2020 15:29 — forked from GuillaumeDerval/log_handler_slack.py
A --log-handler-script log script for snakemake that pushes the status to Slack
# License: MIT
import socket
from slacker import Slacker
import datetime
import time
import threading
SLACK_TOKEN = 'xoxb-00000000000-000000000000-000000000000000000000000'
CHANNEL_NAME = "your-channel-on-slack"
@evd0kim
evd0kim / sparko-request.py
Created December 9, 2019 12:04
sparko-aiohttp
import aiohttp
import asyncio
import logging
from datetime import datetime
from base64 import b64decode, b64encode
import os
import sys
import secrets
import json
@evd0kim
evd0kim / bip32-ec-keys-messages.py
Created September 25, 2019 10:37
Libwally demo-script with message signing
# see also https://github.com/afilini/wally-examples/blob/master/SignMessage.ipynb
import ctypes
from wallycore import *
import base64
def sign_message(privkey, message=""):
"""
returns signed message for derived address
:return:
@evd0kim
evd0kim / SignMessage.py
Last active September 8, 2019 15:50
libwally message signing using extended key
import os
import base64
import wallycore as w
h2b = w.hex_to_bytes
b2h = w.hex_from_bytes
mnemonic = "come fury oil antique match off jar ship six feel fall inflict path race impact monitor loan math goose shop autumn area icon barely"
written, seed = w.bip39_mnemonic_to_seed512(mnemonic, None)
assert written == w.BIP39_SEED_LEN_512
################################################################################
1. Find number of addresses sending funds to an address
################################################################################
SELECT
COUNT(DISTINCT ARRAY_TO_STRING(inputs.addresses, '')) AS addresses
, MIN(block_timestamp) as start_date
FROM `bigquery-public-data.crypto_bitcoin.transactions` AS txns
, UNNEST(txns.outputs) AS outputs
, UNNEST(txns.inputs) AS inputs
@evd0kim
evd0kim / rng-mnemonic.py
Created April 15, 2019 14:37
Simple script for using together python-mnemonic and Moonbase OneRNG
import sys
import time
from mnemonic import Mnemonic
if __name__ == '__main__':
if len(sys.argv) < 2:
print("Suggested usage: rng-mnemonic <keys number> ")
sys.exit(0)
try: