Skip to content

Instantly share code, notes, and snippets.

View dcb9's full-sized avatar

Du, Chengbin dcb9

View GitHub Profile
package main
import (
"fmt"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
@dcb9
dcb9 / 00-windows-daily-apps.md
Last active March 21, 2024 11:12
My Daily Apps

Office 365

Terminal

  • Tabby
  • MobaXterm
  • Cygwin64 Terminal

Search

  • Everything
[package]
name = "counter"
version = "0.1.0"
edition = "2021"
[dependencies]
[dependencies.windows]
version = "0.52"
features = [
sudo su -
# Kernels older than 3.10 lack some of the features required to run Docker containers.
uname -r
3.11.0-15-generic
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list
@dcb9
dcb9 / parseCustomError.js
Last active October 7, 2023 13:51
hardhat ethers parse custom error
const txHash = '0x...';
const contract = await hre.ethers.getContractAt(FIXME);
const tx = await hre.ethers.provider.getTransaction(txHash)
try {
let code = await hre.ethers.provider.call(tx, tx.blockNumber)
} catch (err) {
const code = err.data.replace('Reverted ','');
console.log(code);
console.log(contract.interface.parseError(code));
}
@dcb9
dcb9 / .pdbrc
Created August 30, 2023 03:55
My .pdbrc file
# autocompletion
import rlcompleter
import pdb
pdb.Pdb.complete=rlcompleter.Completer(locals()).complete
# show source code context before and after current line
alias n next ;; l
alias s step ;; l
alias u up ;; l
@dcb9
dcb9 / ANSI.md
Created July 5, 2023 15:27 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@dcb9
dcb9 / clash-for-asus-merlin-ac-5300.md
Last active June 19, 2023 04:02
ASUS Merlin AC-5300 使用 Clash 搭建透明代理