Skip to content

Instantly share code, notes, and snippets.

View kccheung's full-sized avatar
🎯
Focusing

David C kccheung

🎯
Focusing
  • Hong Kong SAR China
View GitHub Profile
@kccheung
kccheung / bitmex-liquidation-calculator.py
Created April 11, 2023 09:08 — forked from highfestiva/bitmex-liquidation-calculator.py
cli bitmex liquidation calculation formula, minimal implementation
#!/usr/bin/env python3
import argparse
from math import ceil, floor
sign = lambda amt: -1 if amt<0 else (1 if amt>0 else 0)
class dobj:
@windsok
windsok / receiving inscriptions and ordinals with sparrow wallet.md
Last active April 25, 2024 08:07
receiving inscriptions and ordinals with sparrow wallet
@highfestiva
highfestiva / bitmex-liquidation-calculator.py
Created October 26, 2019 20:54
cli bitmex liquidation calculation formula, minimal implementation
#!/usr/bin/env python3
import argparse
from math import ceil, floor
sign = lambda amt: -1 if amt<0 else (1 if amt>0 else 0)
class dobj:
@fjahr
fjahr / bitcoin_debugging.md
Last active March 6, 2024 11:43
Debugging Bitcoin Core

Moved to https://github.com/fjahr/debugging_bitcoin to allow for better collaboration.

This document is currently optimized for MacOS. If you would like to help me add Linux equivalent commands, please let me know.

Debugging Bitcoin Core

This guide is designed to give beginners of C++ development and/or people new to the bitcoin core code base an overview of the tools available for debugging issues as well as giving hints where issues may trip you up.

import hashlib
import hmac
import json
import time
import urllib.parse
from threading import Thread
from collections import deque
from requests import Request, Session
from requests.exceptions import HTTPError
@GerardBCN
GerardBCN / volumebar_generator.py
Created April 26, 2019 16:00
Volume bar generator
import numpy as np
# expects a numpy array with trades
# each trade is composed of: [time, price, quantity]
def generate_volumebars(trades, frequency=10):
times = trades[:,0]
prices = trades[:,1]
volumes = trades[:,2]
ans = np.zeros(shape=(len(prices), 6))
candle_counter = 0
@vindard
vindard / cln-sqlite-backup.sh
Last active February 7, 2023 11:41
A script built off of @alexbosworth's backup script that monitors lnd's `channel.backup` file for changes and uploads those changes to Dropbox when detected.
#!/bin/bash
# SET GPG KEY FOR ENCRYPTING WITH (COMPRESSES AS WELL)
GPG=""
# SET DROPBOX API KEY FOR UPLOADS
DROPBOX_APITOKEN=""
# OPTIONAL SET A DEVICE NAME TO BE USED FOR BACKUPS (DEFAULTS TO /etc/hostname)
DEVICE=""
@alexbosworth
alexbosworth / setup_npm.md
Last active October 5, 2023 16:37
Setup NPM

Install make

You will probably need build essential tools

# Ubuntu install build tools:
sudo apt-get install -y build-essential

Install Node.js

@bretton
bretton / lnd-backup-restore-migrate.md
Last active July 27, 2021 04:34
LND Backup, Restore, Migrate

Scriptless Script for DLC

Scriptless Script

Assumptions

pk_script
<witness version 0x0X> <public key / EC point : P >