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 / Cargo.toml
Last active April 12, 2024 18:38
build rust project using bindgen with nix
[package]
name = "test-rust"
version = "0.1.0"
authors = ["yihuang <yi.codeplayer@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@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 / 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-tutorial.md
Last active January 6, 2023 15:33
nix tutorial

nix introduction

nix-env: the package manager

$ nix-env -i hello
installing 'hello-2.10'
these paths will be fetched (0.02 MiB download, 0.07 MiB unpacked):
  /nix/store/mmlnjqg7gbr4w7xjlwj614z97kk1rvfv-hello-2.10
copying path '/nix/store/mmlnjqg7gbr4w7xjlwj614z97kk1rvfv-hello-2.10' from 'https://cache.nixos.org'...
@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",