Skip to content

Instantly share code, notes, and snippets.

View dcb9's full-sized avatar

Du, Chengbin dcb9

View GitHub Profile
[package]
name = "counter"
version = "0.1.0"
edition = "2021"
[dependencies]
[dependencies.windows]
version = "0.52"
features = [
@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 / 00-windows-daily-apps.md
Last active March 21, 2024 11:12
My Daily Apps

Office 365

Terminal

  • Tabby
  • MobaXterm
  • Cygwin64 Terminal

Search

  • Everything
@dcb9
dcb9 / vscode-rmate.md
Last active January 4, 2021 02:47
VSCode rmate:使用本地 VSCode 访问和修改远程计算机文件

1. [本地] VSCode 安装 Remote VSCode

2. [服务器] 安装 https://github.com/aurora/rmate

sudo wget -O /usr/local/bin/rmate https://raw.githubusercontent.com/aurora/rmate/master/rmate
sudo chmod a+x /usr/local/bin/rmate

3. [本地] VSCode 运行

redis.replicate_commands();
local delayBucket = "dq_delay_bucket";
local readyQueuePrefix = "dq_ready_";
while true do
local first = redis.call("ZRANGE", delayBucket, 0, 0, "WITHSCORES");
local currTime = redis.call("TIME");
if first[2] == nil then
@dcb9
dcb9 / clash-for-asus-merlin-ac-5300.md
Last active June 19, 2023 04:02
ASUS Merlin AC-5300 使用 Clash 搭建透明代理