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 / mkenv.sh
Last active December 7, 2024 01:44
build nix shell from python requirements.txt
# build python nix shell from a local `./requirements.txt`
mkdir ./env
cat > ./env/flake.nix << 'EOF'
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
@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证明,客户端合并玩家公钥可得全局公钥