Skip to content

Instantly share code, notes, and snippets.

👨‍💻
Lightning Networking

Damian Mee meeDamian

👨‍💻
Lightning Networking
Block or report user

Report or block meeDamian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@meeDamian
meeDamian / 7z
Created May 8, 2019
Compression comparison
View 7z
/tmp|⇒ /usr/bin/time -l 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on bitcoin-blocks.7z ~/Library/Application\ Support/Bitcoi
n/blocks
412.70 real 379.01 user 7.50 sys
395800576 maximum resident set size
0 average shared memory size
0 average unshared data size
0 average unshared stack size
97211 page reclaims
35 page faults
@meeDamian
meeDamian / README.md
Created Apr 30, 2019
Samourai Wallet backend server
View README.md

If you ever wondered what info about you, Samourai Wallet sends back home, here is how you can see it.

Combine domain with path, to get sth like:

https://api.samouraiwallet.com/v2/multiaddr?active=
@meeDamian
meeDamian / blockchain-growth-btc-bch.sh
Last active Apr 25, 2019
Fetches and compares blockchain size growth between BTC & BCH.
View blockchain-growth-btc-bch.sh
#!/bin/bash
BLOCKCHAIN_INFO_URL="https://api.blockchain.info/charts/blocks-size?timespan=2years&format=csv"
VERy_BITCOIN="https://charts.bitcoin.com/bch/api/chart/blockchain-size"
SPLIT_DATE="2017-08-01"
# I use date for two days ago, as depending on your TZ, bc.info might not have the data yet
RECENT_DATE="$(date -v-2d +%F)"
View chart.json
[[1315872000, 5.800000000000, 6.000000000000, 5.650000000000, 5.970000000000, 58.371382380000, 346.097389394400, 5.929230648356], [1315958400, 5.580000000000, 5.720000000000, 5.520000000000, 5.530000000000, 61.145983620000, 341.854813234800, 5.590797514344], [1316044800, 5.120000000000, 5.240000000000, 5.000000000000, 5.130000000000, 80.140795200000, 408.259002164000, 5.094271914137], [1316131200, 4.820000000000, 4.870000000000, 4.800000000000, 4.850000000000, 39.914006800000, 193.763146600000, 4.854515047084], [1316217600, 4.870000000000, 4.870000000000, 4.870000000000, 4.870000000000, 0.300000000000, 1.461000000000, 4.870000000000], [1316304000, 4.870000000000, 4.920000000000, 4.810000000000, 4.920000000000, 119.812800000000, 579.843102741000, 4.839575594102], [1316390400, 4.900000000000, 4.900000000000, 4.900000000000, 4.900000000000, 20.000000000000, 98.000000000000, 4.900000000000], [1316476800, 4.920000000000, 5.660000000000, 4.920000000000, 5.660000000000, 89.280710680000, 481.049262911600, 5.388053693
View scripts.sh
#!/bin/bash
# [pre-0.17] calculate time differences between all block log entries in `debug.log`
zgrep -ah 'UpdateTip' ~/.bitcoin/debug.lo* | awk '{print $1 " " $2}' | while read -r line; do date -d $line +%s; done | awk 'NR>1{print $1-p} {p=$1}' | while read -r diff; do printf '%dh %dm %ds\n' $((${diff}/3600)) $((${diff}%3600/60)) $((${diff}%60)); done
# [0.17+] same as above
zgrep -ah 'UpdateTip' ~/.bitcoin/debug.lo* | awk '{print $1}' | while read -r line; do date -d $line +%s; done | awk 'NR>1{print $1-p} {p=$1}' | while read -r diff; do printf '%dh %dm %ds\n' $((${diff}/3600)) $((${diff}%3600/60)) $((${diff}%60)); done
# [pre-0.17] get 32 blocks after a longer inactivity persiod (1hr++)
View 00000000eba3f43a8624750f39e4520a1678c0dbdf8707bfa4854a12fbf086c5
00000020d27652d3c0ee533313c5f8d03de810a02f9b80744dea707843197403000000002ecab671461328cf785c0eb21a51221d888fd394138a9c5c7912a2d6152f8913eaf2ab5bffff001d2cb80baf0201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff23030b9515008b0000006376652d323031382d31373134342d6b6873396e650002000000ffffffff01a3edc104000000001976a9142b2399d24a9e9e35487d2f76b57d6e33e72d522f88ac000000000100000002d9bf9d812cfc91e3ff3b7f68e85269f64e7825de0fa61ff9dde117c73b72086a010000008b483045022100e412610b2e2b8370f2eda0cf29fe19c2a4ea35191d8b42656e81bc97026b229e022046ff1df7293f8dbc3efd95b125ebf679a4a68e8de2265990ef7553f1060dc9e301410455fd1c1a6cbfb25b5bba1cf6f850de00d79852be3de51e50c0da683613303c533d079e147dfe07ce4d40df2b776b35184698d14fa107a61e0976b0d9416880c8ffffffffd9bf9d812cfc91e3ff3b7f68e85269f64e7825de0fa61ff9dde117c73b72086a010000008a47304402206fa6ef6c0727ecf8d40b2b4648a93b084396c9819d20a3300e83ac4d110589e8022060c78d44db1d5b5babd1629c55d8058643d11a14da933b4bc5f7a8a2a7da377301410455fd1c1a6cbfb25b5bba1cf6f850de
@meeDamian
meeDamian / pre-setup.log
Created Sep 22, 2018
First complete build logs
View pre-setup.log
+ trap wrap_up TERM INT HUP
+ export DEBIAN_FRONTEND=noninteractive
+ DEBIAN_FRONTEND=noninteractive
+ raspi-config nonint do_change_locale en_US.UTF-8
Generating locales (this might take a while)...
en_US.UTF-8... done
Generation complete.
+ export LANGUAGE=en_US.UTF-8
+ LANGUAGE=en_US.UTF-8
+ export LANG=en_US.UTF-8
@meeDamian
meeDamian / 10-uname
Last active Sep 7, 2018
This is a MOTD for a raspberry pi running bitcoind and either lnd or lightning (or both). To install, download and execute `install.sh` file.
View 10-uname
#!/bin/sh
. /usr/local/lib/metrics/colors.sh
. /usr/local/lib/metrics/board.sh
echo
echo -n "${WHITE}Raspberry Pi ($(get_host), $(get_public_ip), $(get_local_ip))${RESET_STYLE} " && uname -rm
uptime
@meeDamian
meeDamian / bitcoind.sh
Last active Sep 21, 2018
This is a series of utility functions to interface with RBP metrics, bitcoind, lnd and lightningd. To install, download and execute `install.sh` file.
View bitcoind.sh
#!/bin/sh
. /usr/local/lib/metrics/utilities.sh
# BITCOIN CORE
# ------------
#
# * assumes default ~/.bitcoin folder location
# * tries to detect bitcoin-cli path
# * tries to determine user running bitcoind
View set_ports_known_gate.sh
#!/bin/sh
LN_PORT=9735
ROUTER_UPNP=http://192.168.0.1:1900/gatedesc.xml
IP="$(ip route get 1 | awk '{print $NF;exit}')"
SSH_PORT="22$(echo ${IP} | cut -d '.' -f4)"
# ssh
upnpc -u "${ROUTER_UPNP}" -e "$(hostname): ssh" -a ${IP} 22 ${SSH_PORT} TCP
You can’t perform that action at this time.