Skip to content

Instantly share code, notes, and snippets.

View matheusd's full-sized avatar

Matheus Degiovani matheusd

View GitHub Profile
@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
@matheusd
matheusd / ticketreport.md
Created September 5, 2018 12:30
Ticket Status Report

Procedure to generate a report on ticket status. You need access via rpc to a dcrd node and the jq tool installed.

This might take a long time to run if you have many tickets.

  1. Grab the list of transactions of the wallet:
$ dcrctl --wallet listtransactions "*" 999999999 > txs.txt
@matheusd
matheusd / fees.txt
Created September 3, 2018 12:09
Dump of fee estimator state for mainnet as of 2018-09-03
| 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.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000 0.0| 0.00000000
#!/bin/sh
# Minimal tmux script to create a master dcrd simnet node + ticket
# bying wallet. Heavily based on davecgh script at:
# https://gist.github.com/davecgh/7bb5c995665787811dc6a6ddbb49688d
set -e
SESSION="dcrd-fees"
NODES_ROOT=~/dcrdsimnetnodes
RPCUSER="USER"
@matheusd
matheusd / bookmarklet.js
Created November 14, 2017 13:09
Improve Github PR inputs
// This is a bookmarklet to improve github's PR inputs (the PR title and PR comment)
// This adds a maxlength of 50 to the PR title and changes the comment to use a
// monospaced font.
//
// To use it, add a bookmark to your browser's bookmark bar and copy the following
// line as its content.
javascript:(function(){document.getElementById("pull_request_title").maxLength = 50; document.getElementById("pull_request_body").style.fontFamily = 'Mono' ; document.getElementById("pull_request_body").parentNode.style.backgroundColor = "#ffffc0" })()
@matheusd
matheusd / vid2gif.sh
Created October 3, 2017 17:17
ffmpeg script to convert mp4 to gif
#!/bin/sh
# Use as ./vid2gif.sh <filename.mp4>
SRC=$1
DST="$1.gif"
ffmpeg -y -i $SRC -vf fps=10,scale=1280:-1:flags=lanczos,palettegen palette.png
ffmpeg -y -i $SRC -i palette.png -filter_complex "fps=10,scale=1280:-1:flags=lanczos[x];[x][1:v]paletteuse" $DST
@matheusd
matheusd / autoclick
Created August 31, 2017 11:09
A bash autoclicker using xdotool (clicks automatically after moving the mouse)
#!/bin/bash
# Bash Autoclicker
# Simulates key presses automatically when the mouse is moved
# Written by matheusd.com
# License: Public
((OLDX=0))
((OLDY=0))
((LIMIT = 4 * 4))
#!/bin/bash
DEVICE=$1
TARGETVM=$2
USB_DEVICE=`qvm-usb |grep $DEVICE |cut -f1`
# Is it already attached
qvm-usb |grep $USB_DEVICE | grep "(attached to "
if [ $? -eq 0 ]; then
echo "detatching $DEVICE"
qvm-usb -d $USB_DEVICE