Skip to content

Instantly share code, notes, and snippets.

View LarryRuane's full-sized avatar

Larry Ruane LarryRuane

View GitHub Profile
@LarryRuane
LarryRuane / memo-cli.md
Last active June 11, 2020 23:44
How to send and receives encrypted Zcash transaction memos using zcash-cli

Memos for full-nodes

This document explains how to send and receive encrypted Zcash transaction memos using zcash-cli (the RPC interface). The not-so-user-friendly aspect of the RPC interface is that the memos are in hexadecimal string format. (The various wallets, such as Zecwallet and ZECC wallet, hid this detail from their users.) So to send as ascii text string as a memo requires first converting the string to hex, and to read the memo later as a text string requires converting from hex back to a string.

Tools

The following two tools will be handy.

@LarryRuane
LarryRuane / reorg-testing.md
Created April 16, 2020 17:35
reorg testing using darksidewalletd

Reorg testing

Currently, in this branch, the lightwalletd knows a pre-determined range of 101 blocks, 663150 - 663250. These are real mainnet blocks that contain several transactions that include shielded payments to or from the "developer wallet".

From now on, we'll just abbreviate these heights by dropping the 663 prefix.

Initial state

@LarryRuane
LarryRuane / review-force-push-demo.sh
Created January 14, 2020 15:41
bash script to demonstrate how a reviewer can see what changed after a force-push
#!/usr/bin/env bash
#
# This script demonstrates how a reviewer can see only what's
# changed after a developer has overwritten a commit by doing a
# force-push to correct a bug or make a reviewer-requested change.
# The reviewer doesn't really want to have to re-review the entire
# change; it may be hard to pick out exactly what was force-pushed.
#
# The key idea is for the reviewer to make a temporary branch before
# re-fetching the developer's branch.
{
"cells": [
{
"cell_type": "code",
"execution_count": 60,
"metadata": {},
"outputs": [],
"source": [
"############## PLEASE RUN THIS CELL FIRST! ###################\n",
"\n",
@LarryRuane
LarryRuane / patch.diff
Created November 21, 2019 17:24
patch to https://github.com/fullstorydev/grpcurl to enable repeating the given RPCs for performance measurements
diff --git a/cmd/grpcurl/grpcurl.go b/cmd/grpcurl/grpcurl.go
index aaa3bbf..92489ef 100644
--- a/cmd/grpcurl/grpcurl.go
+++ b/cmd/grpcurl/grpcurl.go
@@ -115,6 +115,9 @@ var (
Enable verbose output.`))
serverName = flags.String("servername", "", prettify(`
Override server name when validating TLS certificate.`))
+ repeatCount = flags.Int("repeat", 1, prettify(`
+ Submit the rpc the given number of times (default 1), for performance
@LarryRuane
LarryRuane / ack-tree-hash-demo.sh
Last active August 1, 2019 16:36
Better ACK - squash interaction using git tree hash
#!/bin/bash
#
# This script demonstrates how to use the git tree hash to allow squashing
# after ACKs without invalidating the ACK.
#
# ACKs in PRs often mention the commit hash being approved, but if the developer
# then squashes before the merge, this changes the commit hash (the post-squash
# commit hash doesn't match the latest pre-squash commit hash). This is because
# the commit hash depends on things that squashing changes.
#
(gdb) p tx
$4 = {
<CMerkleTx> = {
<CTransaction> = {
hash = {
<base_blob<256>> = {
data = "\026(\276\235\371\062\367R\212\276\300\202\335D\205\225mWh\366q\221\233\257?\377\250\315\302\035\373\030"
}, <No data fields>},
static SPROUT_MIN_CURRENT_VERSION = 1,
static SPROUT_MAX_CURRENT_VERSION = 2,
@LarryRuane
LarryRuane / fives.rs
Created December 10, 2018 18:22
count the number of times "5" appears when counting from 1 to 1000
fn main() {
let mut c = 0;
for i in 1..=1000 {
let mut j = i;
while j > 0 {
if j % 10 == 5 {
c += 1;
}
j /= 10;
}