Skip to content

Instantly share code, notes, and snippets.

@oneleo
oneleo / remapLRShift.json
Last active August 5, 2023 01:25
karabiner-elements: partial solution while changing language inputs between EN and ZH
{
"title": "LR_Shift to Ctrl+Space",
"rules": [
{
"description": "Change L_Shift to switch EN/ZH condition",
"manipulators": [
{
"type": "basic",
"conditions": [
{
@oneleo
oneleo / prev_randao.py
Created April 28, 2023 03:19 — forked from a2468834/prev_randao.py
Calculate next slot prev_randao
import hashlib
import string
##### Helper function #####
ssz_byteorder = "little" # https://github.com/ethereum/consensus-specs/blob/dev/ssz/simple-serialize.md
# https://github.com/ethereum/consensus-specs/blob/dev/ssz/simple-serialize.md#aliases
def isBytesN(input_):
# BytesN := Vector[uint8, N]
assert isinstance(input_, list)
title tags
有關上海升級,你需要知道的事 (test gist)
imToken, Staking Withdraw, envTest

以太坊上海升級,和你有關嗎?

前言

以太坊上海升級即將來臨,對於生態系裡的不同角色,針對此升級要做的事也有所不同。此篇文章我們帶領大家導覽上海升級與你的關係,並且該做什麼事來應對。

HackMD特殊MarkDown語法

這邊要跟大家介紹非常好用功能:內建目錄 打上[TOC]會自動建立目錄

目錄

[TOC]以下為TOC特殊語法 [TOC]

@oneleo
oneleo / README-mainnet.md
Last active January 5, 2023 01:48
ens-offchain-resolver

ENS Offchain Resolver

假設您已從 ens.domains 獲得了一組 ENS(在這裡我們以 token.eth 為例),並且在這之前我們已架設完成了一個 off-chain gateway server。

下面的說明將解釋如何將 off-chain gateway server 與 on-chain token.eth ENS 進行關聯,以便 ethers.js 可以從 off-chain gateway server 成功查詢到對應的 ENS Ethereum 地址。

在本文中,我們假設您已架設好的 off-chain gateway server 資訊及儲存的資料如下:

payload: 0x30875978000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000100000000000000000000000011fe4b6ae13d2a6055c8d9cf65c55bac32b5d844000000000000000000000000da10009cbd5d07dd0cecc66161fc93d7c9000da10000000000000000000000002f897200a84478e71fd07a9137ee63a0242092e50000000000000000000000002f897200a84478e71fd07a9137ee63a0242092e50000000000000000000000000000000000000000000000000000000000000064332156fabd471fdd1ae4234d1bd54836b23cd1230a7de51368e07458dc5d85720000000000000000000000000000000000000000000000000000000063a6b90500000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006205970d4da01a0290c88db54c37689143b8f81c51cd4f0049c91440405c3921641402176cfae517252ea86b5080c6e237973d9146ac494
@oneleo
oneleo / gist:ec28bfb312f3f658279e2889bbbd0180
Last active October 12, 2022 07:31
Print Byte32 via Foundry Test
// Reference: https://stackoverflow.com/questions/67893318/solidity-how-to-represent-bytes32-as-string
// Excute: forge test -vvv --match-path "contracts/test/Spender.t.sol" --match-test "testSpendFromUser*"
function testSpendFromUser() public {
bytes32 out1 = keccak256(
abi.encodePacked(
"SpendWithPermit(",
"address tokenAddr,",
"address user,",
"address recipient,",
@oneleo
oneleo / chtti_g217_g313_choco.txt
Last active November 10, 2021 07:49
chtti g217 g313 choco
// https://chocolatey.org/
> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
:: 驅動
> choco install -y vmware-tools
> choco install -y nvidia-display-driver
:: APP 指令程式
{"name":"Cardano ADA Pool","ticker":"ADATW","description":"Cardano ADA Pool","homepage":"https://www.facebook.com/groups/ada.tw"}