Skip to content

Instantly share code, notes, and snippets.

@csknk
csknk / getchaintips.sh
Created August 25, 2023 17:08
Basic script to run against Bitcoin bitcoind server on LAN
#!/usr/bin/env bash
# Basic script to run against Bitcoin bitcoind server on LAN
# Ref: Bitcoin Core getchaintips RPC command: https://bitcoincore.org/en/doc/0.21.0/rpc/blockchain/getchaintips
set -eou pipefail
IFS=$'\n\t'
# Set variables ----
user=XXXXXX
password=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
node_ip=192.168.0.XXX
@csknk
csknk / switch-go.sh
Created July 4, 2022 15:00
Switch Go Versions
#!/usr/bin/env bash
set -eo pipefail
IFS=$'\n\t'
GREEN='\033[32;1m'
RED='\033[91;1m'
RESET='\033[0m'
function colecho {
echo -e "${2}${1}${RESET}"
{
"jsonrpc": "2.0",
"result": "0x6d6574610e690a000c1c73705f636f72651863727970746f2c4163636f756e7449643332000004000401205b75383b2033325d0000040000032000000008000800000503000c08306672616d655f73797374656d2c4163636f756e74496e666f0814496e64657801102c4163636f756e74446174610114001401146e6f6e6365100114496e646578000124636f6e73756d657273100120526566436f756e7400012470726f766964657273100120526566436f756e7400012c73756666696369656e7473100120526566436f756e740001106461746114012c4163636f756e7444617461000010000005050014083c70616c6c65745f62616c616e6365732c4163636f756e7444617461041c42616c616e63650118001001106672656518011c42616c616e6365000120726573657276656418011c42616c616e636500012c6d6973635f66726f7a656e18011c42616c616e63650001286665655f66726f7a656e18011c42616c616e636500001800000507001c0c346672616d655f737570706f72741c77656967687473405065724469737061746368436c6173730404540120000c01186e6f726d616c2001045400012c6f7065726174696f6e616c200104540001246d616e6461746f727920010454000020000005060024083c7072696d69746976655f747970657310483
@csknk
csknk / generate_blocks.sh
Created May 24, 2022 18:32 — forked from System-Glitch/generate_blocks.sh
Tutorial for bitcoin regtest
# Script to generate a new block every minute
# Put this script at the root of your unpacked folder
#!/bin/bash
echo "Generating a block every minute. Press [CTRL+C] to stop.."
address=`./bin/bitcoin-cli getnewaddress`
while :
do
endpoint=http://dot-testnet.qredo.loc:9934/
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "system_properties"}' "${endpoint}"

VIM-GO

Plugin https://github.com/fatih/vim-go
Tutorial https://github.com/fatih/vim-go-tutorial
Vimrc https://github.com/fatih/dotfiles/blob/master/vimrc

Run

Commands

  • File :GoRun %
  • Package :GoRun
  • Debug :GoDebugStart
@csknk
csknk / extrinsic_test.go
Last active November 11, 2021 14:31
extrinsic_test.go
package main
import (
"bytes"
"fmt"
"math/big"
"testing"
"github.com/centrifuge/go-substrate-rpc-client/v3/scale"
"github.com/centrifuge/go-substrate-rpc-client/v3/types"
@csknk
csknk / returning-strings-from-function.rs
Last active August 19, 2020 20:33 — forked from rust-play/playground.rs
Code shared from the Rust Playground
fn main() {
let s = String::from("book");
let ss = pluralize(s.clone());
println!("One {}, many {}", s, ss);
}
fn pluralize(s: String) -> String {
// Can't push_str directly onto s as s is not mutable
@csknk
csknk / trait_extension_to_print_bytes_as_hex.rs
Last active July 3, 2020 20:15 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::fmt;
fn main() -> Result<(), &'static str> {
let b = vec![0x64, 0x61, 0x76, 0x65];
println!("{}", b.to_hex());
Ok(())
}
trait ToHex {
fn to_hex(&self) -> String;

Keybase proof

I hereby claim:

  • I am csknk on github.
  • I am davidegan (https://keybase.io/davidegan) on keybase.
  • I have a public key ASAbhAOh7ePeAwlFbeYaEBTAWWNzLPvqwfizEybiynk3FAo

To claim this, I am signing this object: