Plugin https://github.com/fatih/vim-go
Tutorial https://github.com/fatih/vim-go-tutorial
Vimrc https://github.com/fatih/dotfiles/blob/master/vimrc
- File
:GoRun % - Package
:GoRun - Debug
:GoDebugStart
| package main | |
| import ( | |
| "bytes" | |
| "crypto/sha256" | |
| "encoding/binary" | |
| "encoding/hex" | |
| "fmt" | |
| "strings" | |
| ) |
| #!/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 |
| #!/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 |
| # 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}" |
| 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" |
| 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 |
| 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; |