Skip to content

Instantly share code, notes, and snippets.

View matheusd's full-sized avatar

Matheus Degiovani matheusd

View GitHub Profile
@matheusd
matheusd / .gitconfig
Created October 13, 2020 11:39
git aliases
[alias]
l = !"git lshort --graph"
lg = !"git lg1"
lg1 = !"git lg1-specific --all"
lg2 = !"git lg2-specific --all"
lg3 = !"git lg3-specific --all"
cp = cherry-pick
cpc = cherry-pick --continue
st = status
package main
import (
"sync"
)
func Highway(asyncProcessor EventProcessor, numWorkers int, inputC chan Event) chan HydratedEvent {
outputC := make(chan HydratedEvent, 0)
type worker struct {
@matheusd
matheusd / gist:02453f59e9d9da731eff154733d87b6c
Last active July 8, 2020 18:25
A script to check a dcrlnd commit if it's reasonably sane. Useful to check a range of commits by using a `git rebase [target] --exec ./checkcommit.py --modtidy --test --rpc --lint --showcommit --nofooter`
#!/bin/python3
import sys
import subprocess
from os import path
from functools import reduce
class bcolors:
RED = '\033[31m'
BLUE = '\033[34m'
@matheusd
matheusd / pre-push
Created July 8, 2020 18:23
Pre-push hook to verify all commits were gpg signed
#!/bin/sh
# Somewhat adapted from the same hook and from
# https://gist.github.com/kotnik/ef3a62316aa5e8e788a6e4365cb41878
#
# Uses my git lshort alias on error.
remote="$1"
url="$2"
Props to Pierre-Marie Padiou via https://github.com/lightningnetwork/lightning-rfc/issues/553#issuecomment-455641943
+------------+
| funding tx |
+------------+
|
| +-------------+
\--------| commit tx B |
+-------------+
| | | |
@matheusd
matheusd / spv.tmux
Created October 6, 2018 12:19
Tmux automation for setting up an spv wallet
#!/bin/sh
# Tmux setup for running an spv wallet. This creates two wallets (connected to
# the same master node): one using regular RPC mode with the ticketbuyer and
# voting enabled and a second one with SPV enabled. It receives some coins
# after block 32.
#
# The spv wallet is created in the "spv" dir.
set -e
$ ./dcrctl.sh getblockchaininfo
{
"chain": "mainnet",
"blocks": 279436,
"headers": 279436,
"bestblockhash": "00000000000000004d1ca3ac7aab36e4857f97e78876fc405a1986e99bc87b5a",
"difficulty": 419481279,
"verificationprogress": 0.9962138767477843,
"chainwork": "0x8836d4f2be1b9cdeff59",
"initialblockdownload": true,
@matheusd
matheusd / parallel-nodes.tmux
Created October 5, 2018 13:47
Tmux setup for simnet and 2 parallel nodes with wallets to test reorgs
#!/bin/sh
#
# Script to setup parallel dcrd nodes with separate wallets.
# Useful for testing reorgs by disconnecting nodes, mining individually, then
# reconnecting them.
#
# alpha <------> beta
# listen 19100 19200
# rpclisten 19101 <. .> 19201
# w-alpha | | w-beta
@matheusd
matheusd / fees.txt
Created September 14, 2018 17:32
Dump of fee estimator state after ~2 weeks on mainnet - 2018-09-14
| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31| +Inf
0.00010000| 0.00000000 0.0| 0.00010000 0.1| 0.00010000 0.1| 0.00010000 0.1| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000 0.9| 0.00010000
@matheusd
matheusd / dcr-serial-nodes.sh
Created September 10, 2018 12:09
Setup 4 dcrd simnet nodes using a serial network topology
#!/bin/sh
# Tmux script to create 4 dcrd nodes connected in series. Useful for testing
# message relaying
# Network layout:
# master <-> 1 <-> 2 <-> 3
# 19555 19665 19675 19685
set -e