Skip to content

Instantly share code, notes, and snippets.

View dcb9's full-sized avatar

Du, Chengbin dcb9

View GitHub Profile
module.exports.parse = ({ content, name, url }, { yaml, axios, notify }) => {
if (content && content.rules) {
const targets = ["国外流量"]
for (const target of targets) {
const hasTarget = content.rules.some((ele) => ele.includes(target))
if (hasTarget) {
const domainSuffixes = [
"rs", "io", "npmjs.org", "notion.so", "etherscan.io",
]
for (const domain of domainSuffixes) {
@dcb9
dcb9 / extractable-one-time-signatures-example-in-go.go
Last active December 10, 2024 14:36
babylon EOTS(Extractable one-time signatures) example in go https://go.dev/play/p/5cdeTT96Sj0
package main
import (
"crypto/rand"
"fmt"
"github.com/babylonchain/babylon/crypto/eots"
)
func main() {
[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 December 19, 2024 06:38
My Daily Apps
@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