Skip to content

Instantly share code, notes, and snippets.

View yihuang's full-sized avatar
🏠
Working from home

yihuang yihuang

🏠
Working from home
  • crypto.com
  • Shenzhen, China
View GitHub Profile
@yihuang
yihuang / binary_search_benchmark.go
Created May 2, 2023 16:10
Benchmark new binary search algorithm against golang std one
package main
import (
"bytes"
"encoding/binary"
"math/rand"
"sort"
"testing"
"github.com/stretchr/testify/require"
@yihuang
yihuang / nix-remote-builder-with-colima.md
Last active July 13, 2023 12:21
nix remote builder setup with (co)lima
  • install (co)lima

    I haved setup colima already, but you can setup lima vm directly without the (co).

  • prepare the ssh config

    $ limactl show-ssh colima -f config >> ~/.ssh/config
    

    in my case, the host name is lima-colima.

  • install nix in the vm

@yihuang
yihuang / benchmark_integer_compare.go
Last active December 24, 2022 16:07
benchmark different way to compare encoded integer in golang
package test
import (
"bytes"
"encoding/binary"
"testing"
)
var bz1, bz2 [8]byte
@yihuang
yihuang / delete_orphan_records.go
Last active December 12, 2022 02:16
Delete IAVL orphan records using compaction filter
package main
import (
"bytes"
"fmt"
"os"
"github.com/cosmos/gorocksdb"
)
@yihuang
yihuang / f2l-notes.md
Last active August 21, 2022 14:07
F2L笔记

F2L笔记

41种标态

右手 左手
基本情况
1, 4, 2, 3
1 4 2 3
顶层 - 分离 - 白色朝侧 - 同色5 7 6 8
@yihuang
yihuang / pyevm_console_log.py
Created May 20, 2022 01:04
Monkey patch pyevm to support hardhat console.log
"""
Monkey patch py-evm to support console.log
"""
from eth.abc import ComputationAPI, MessageAPI
from eth.vm.computation import BaseComputation
from eth_abi import decode_abi
from eth_typing import Address
CONSOLE_LOG_ADDRESS = Address(
@yihuang
yihuang / blocks.txt
Created May 16, 2022 07:14
the block numbers to patch
5050
5075
6346
6380
6471
6541
6542
8751
8753
8748
{
"openapi": "3.0.2",
"info": {
"title": "FastAPI",
"version": "0.1.0"
},
"paths": {
"/token": {
"post": {
"summary": "Login",
# Poker Design Notes
## 合约框架
### CheckIn
- 创建牌桌,初始化参数
- 玩家加入,锁定资产
- 玩家提交公钥和DLOG证明,客户端合并玩家公钥可得全局公钥
@yihuang
yihuang / demo.sol
Last active August 6, 2021 06:40
some pseudocode to demonstrate interaction between evm contract and host system
contract ERC20 {
map[address][uint256] _balances;
// deposit through native module
// native module will first move user's native tokens to contract address,
// then mint on evm directly
function deposit(receipient, amount) {
require(msg.sender == native_module_address)
_balances[receipient] += amount;
}