YubiKey-Guide

tags: GPG, Yubikey source: https://github.com/drduh/YubiKey-Guide

October 5, 2023 · 1 min · Gray King

A Visual Explanation of GPG Subkeys

tags: GPG, Yubikey source: “A Visual Explanation of GPG Subkeys - Richard Goulter’s Blog.” Accessed October 5, 2023. https://rgoulter.com/blog/posts/programming/2022-06-10-a-visual-explanation-of-gpg-subkeys.html. What does the [SC] or [E] mean in the output of gpt --list-keys: E = encrypt/descript S = sign C = certify(sign another key, establishing a trust relation) A = authentication(log in to SSH with a PG key)

October 5, 2023 · 1 min · Gray King

sui_getTransactionBlock

tags: Sui POST https://fullnode.mainnet.sui.io Content-Type: application/json { "jsonrpc": "2.0", "id": 1, "method": "sui_getTransactionBlock", "params": [ "6wthaE4QzjWM7HnAzm6Pd4ymkNtadbHnqQkTXY7Ne1L3", { "showInput": true, "showRawInput": false, "showEffects": true, "showEvents": true, "showObjectChanges": true, "showBalanceChanges": true } ] }

September 26, 2023 · 1 min · Gray King

FreeBSD 13.2 NFS

Tags: FreeBSD First, configure to start service during the bootstrap: sysrc nfs_server_enable="YES" sysrc nfs_server_flags="-u -t -n 4" sysrc rpcbind_enable="YES" sysrc rpc_statd_enable="YES" sysrc rpc_lockd_enable="YES" sysrc mountd_flags="-r" sysrc mountd_enable="YES" Second, export volume to the network in /etc/exports: /data/warehouse -mapall=root -network 192.168.1.0/24 NOTE: you shouldn’t export the pool root while you are using ZFS, as it can’t show the children in a datasets of it. And then we can start the services: ...

September 15, 2023 · 1 min · Gray King

ZFS

September 11, 2023 · 0 min · Gray King

ZFS 入门指北:规划与创建存储池

tags: FreeBSD, ZFS source: Shen Leo. “ZFS 入门指北:规划与创建存储池.” Leo’s Field, March 21, 2022. https://szclsya.me/zh-cn/posts/storage/zfs-setup/.

September 11, 2023 · 1 min · Gray King

FreeBSD

September 11, 2023 · 0 min · Gray King

Building a FreeBSD backup server

TAGS: FreeBSD, NAS Source: “Building a FreeBSD Backup Server.” Accessed September 11, 2023. https://ogris.de/howtos/freebsd-backup-server.html. $ zfs create -quota=1T data/timemachine [global] workgroup = WORKGROUP security = user netbios name = backup server string = backup.your-local-domain.invalid hostname lookups = yes load printers = no show add printer wizard = no time server = yes map to guest = Bad User use mmap = yes dos charset = 850 unix charset = UTF-8 mangled names = no log level = 0 vfs objects = fruit streams_xattr zfsacl fruit:model = MacPro fruit:resource = file fruit:metadata = netatalk ; time machines [macbook] path = /data/timemachine read only = no use sendfile = yes browseable = no hosts allow = macbook.your-local-domain.invalid fe80::/10 fruit:time machine = yes fruit:time machine max size = 500G valid users = tm Then we can set our Macbook Pro to use the timemachine: ...

September 11, 2023 · 1 min · Gray King

Sui

TAGS: Blockchain

September 11, 2023 · 1 min · Gray King

Sui Move Call

TAGS: Sui POST http://127.0.0.1:9000 Content-Type: application/json { "jsonrpc": "2.0", "method": "sui_moveCall", "params": [ "0x1", "0xc8", "obc_dao", "voting_delay", " ] }

September 11, 2023 · 1 min · Gray King

Uniswap V3 Event Log

tags: Uniswap V3, Ethereum POST https://rpc.ankr.com/eth Content-Type: application/json { "jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionReceipt", "params": ["0xeedf302cc12f4b7194742694aabec075c1c229f7b9d8e57a53c44c992bc6690c"] }

July 31, 2023 · 1 min · Gray King

The Best Way To Launch Your Startup

tags: Microstartup source: The Best Way To Launch Your Startup | Startup School, 2023. https://www.youtube.com/watch?v=u36A-YTxiOw. Emphasis Launch it ASAP, and launch it again and again. How to Write a Pitch 1-line description to introduce your bussiness: Tell WHAT, not WHY(maybe later). What problem it it solving, and for who. X for Y may not the best sentence. Ways: Launch in Different Channels Silent Launch Launch to Friends and family Launch to Strangers Online Community Lanuch: HN Waitlist Launch: Domain/Landing Page/Email list.

July 26, 2023 · 1 min · Gray King

Should I read papers

tags: Papers source: “Mrb: Should I Read Papers?” Accessed February 20, 2023. https://michaelrbernste.in/2014/10/21/should-i-read-papers.html. Yes, but reading a paper isn’t the same as reading a blogpost or a novel. A paper could be an idea captured by someone, or the result of a life’s work, or anything in between. You might need to read it bit by bit, again and again.

July 19, 2023 · 1 min · Gray King

Software Engineers Should Read Academic Papers

tags: Papers source: Al-Ansari, Khaled. “Software Engineers Should Read Academic Papers.” Medium (blog), July 15, 2023. https://medium.com/@KhaledElAnsari/software-engineers-should-read-academic-papers-9a6ee6ebc40d. There are some benefits of reading academic papers: Structured content can enhance your technical writing, you can learn structured writing. (Reading - Writing - Reviewing) cycle making you a better reader and reviewer. Reading to gain information. Structured writing make review easier. Better deading and writing make you a better reviewer. Bridge the industry and the academic field. ...

July 17, 2023 · 1 min · Gray King

Solana Off-Chain Message Signing

tags: Solana source: https://github.com/solana-labs/solana/blob/eabe1070667e87f447b9cb892e2d916ca5b68e34/sdk/src/offchain_message.rs#L237-L240 /// Serialize the off-chain message to bytes including full header pub fn serialize(&self) -> Result<Vec<u8>, SanitizeError> { // serialize signing domain let mut data = Self::SIGNING_DOMAIN.to_vec(); // serialize version and call version specific serializer match self { Self::V0(msg) => { data.push(0); msg.serialize(&mut data)?; } } Ok(data) }

June 15, 2023 · 1 min · Gray King

Ethereum Execution Layer

tags: Ethereum Networking Layer

June 14, 2023 · 1 min · Gray King

Ethereum Sub-protocols

tags: Ethereum Networking, Ethereum Execution Layer

June 14, 2023 · 1 min · Gray King

Ethereum Wire Protocol

tags: Ethereum Sub-protocols, Ethereum Simulator Node Started when a RLPx session had initiated. Three main tasks before switch to PoS: Chain synchronization Block propagation Transaction exchange: exchange pending transaction between nodes. Only transaction exchange remit after switch to PoS.

June 14, 2023 · 1 min · Gray King

Ethereum DevP2P

tags: Ethereum Networking, Ethereum Execution Layer Basic stack for p2p networking. Initiating RLPx Session. RLPX Session Communicate messages that encoded in RLP between peers.

June 14, 2023 · 1 min · Gray King

Ethereum Networking Layer

tags: Ethereum source: https://ethereum.org/en/developers/docs/networking-layer/

June 14, 2023 · 1 min · Gray King

Ethereum Discovery Nodes

tags: Ethereum Networking, Ethereum Simulator Node Boot nodes Using a small set that hardcoded bootnodes to bootstrap. Protocol Kademlia a modified form of Distributed Hash Table. Steps to join the network start client –> connect to bootnode –> bond to bootnode –> find neighbours –> bond to neighbours

June 14, 2023 · 1 min · Gray King

How is a Transaction Broadcasted

tags: Ethereum Simulator Node, Ethereum Execution Layer Node Side: Receive pending transactions If we want to broadcast our transactions to the network in Ethereum, two RPC calls are involved: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction So let’s follow those two calls to track how a transaction is broadcasted. Those two corresponding implementations are defined at internal/ethapi/api.go: SendTransaction SendRawTransaction And both of them are pointing to SubmitTransaction, which calls SendTx to put transaction into the txpool by calling: func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error { return b.eth.txPool.AddLocal(signedTx) } Miner Side: Execute pending transactions Miner start here at cmd/geth/main.go, which is calling: ...

June 12, 2023 · 2 min · Gray King

Ethereum Simulator Node

tags: Ethereum Simulator Only use the data of the mainnet to simulate transaction, and DONOT commit the final transaction to the mainnet. Relay To identify our transactions that need to simulate, if it’s failed then drop that tx, otherwise commit the final transaction to the mainnet. Things need to consider: How to limit or identify transactions that need to simulate? Only execute the transactions from local txpool. Where to execute the transction previously? ...

June 12, 2023 · 1 min · Gray King

How to Write a Technical Article

tags: Essay Writing Guide List outlines Explore the resources and documentation to understand Taking notes during the exploring Use the method of How to Take Smart Notes

June 8, 2023 · 1 min · Gray King

English Words

tags: Learning English, Journal

June 8, 2023 · 1 min · Gray King

Journal

June 8, 2023 · 0 min · Gray King

coherent

tags: English Words Adjective (of an argument , theory, or policy) logical and consistent: they failed to develop a coherent economic strategy. united as or forming a whole: divided into a number of geographically coherent kingdoms. Physics (of waves) having a constant phase relationship.

June 8, 2023 · 1 min · Gray King

Essay Writing Guide

source: https://jordanbpeterson.com/wp-content/uploads/2018/02/Essay_Writing_Guide.docx tags: How to Write PART I: INTRODUCTION Why are we need to learn how to write an essay? Writing an essay is to think by writing, formulate and organize ideas. Writing an essay is also to learn or explore a new topic. How to get things done? If you don’t have a big chunk of time in your daily life, then don’t relay your success on it, take 15 minutes every day is still powerful: 「日拱一卒,功不唐捐」. ...

June 8, 2023 · 2 min · Gray King

PostgresQL autovacuum & ANALYZE

tags: PostgresQL Recently, I met a problem in PostgresQL: the index mismatched after batch rows inserted. Run ANALYZE on the table solved this problem after batch rows inerted. Turns out autovacuum has been disabled on the PostgresQL instance: show autovacuum_analyze_scale_factor; show autovacuum_analyze_threshold ; SELECT * FROM pg_settings WHERE name LIKE '%autovacuum%';

May 29, 2023 · 1 min · Gray King

Met Eddie

tags: On The Road https://www.google.com/maps/dir/New+York/Joliet/Rock+Island,+IL/Rapids+City,+IL/Des+Moines,+IA/Adel,+Iowa/Stuart,+Iowa/Council+Bluffs,+Iowa/Omaha,+NE/Grand+Island,+NE/@40.7489186,-96.7492412,5z/data=!3m1!4b1!4m62!4m61!1m5!1m1!1s0x89c24fa5d33f083b:0xc80b8f06e177fe62!2m2!1d-74.0059728!2d40.7127753!1m5!1m1!1s0x880e456bec363d7d:0x9f9e66f7a36bc042!2m2!1d-88.0817251!2d41.525031!1m5!1m1!1s0x87e232c357044b77:0xecc19371d71475f1!2m2!1d-90.5787476!2d41.5094771!1m5!1m1!1s0x87e23f0ad2e7aeb3:0x43aab678fe9e328d!2m2!1d-90.3434615!2d41.5817!1m5!1m1!1s0x87ee99a4c1611ee7:0x710028512691e4b2!2m2!1d-93.6249593!2d41.5868353!1m5!1m1!1s0x87ec39285c3540b9:0x84581d5d4142c1ec!2m2!1d-94.017453!2d41.6144325!1m5!1m1!1s0x87ec60c99a9a7d0f:0xb0c00a66d8103978!2m2!1d-94.3183715!2d41.5034243!1m5!1m1!1s0x879381cfa109322f:0xbe4e81fa5222799e!2m2!1d-95.8608333!2d41.2619444!1m5!1m1!1s0x87938dc8b50cfced:0x46424d4fae37b604!2m2!1d-95.9345034!2d41.2565369!1m5!1m1!1s0x87998644ec7765f7:0xa12d5b784951b17b!2m2!1d-98.3420118!2d40.9263957!3e0

May 8, 2023 · 1 min · Gray King

On The Road

May 8, 2023 · 0 min · Gray King

Emacs on Macos: Too Many Files Open

tags: Emacs, macOS source: Simon, Ben. “Gotcha: Emacs on Mac OS: Too Many Files Open.” Accessed April 18, 2023. https://www.blogbyben.com/2022/05/gotcha-emacs-on-mac-os-too-many-files.html. Add below code snippet to your init.el: (defun file-notify-rm-all-watches () "Remove all existing file notification watches from Emacs." (interactive) (maphash (lambda (key _value) (file-notify-rm-watch key)) file-notify-descriptors)) Then just execute M-x file-notify-rm-all-watches when you meet this problem next time.

April 18, 2023 · 1 min · Gray King

NLTK Data

tags: AI Clone nltk_data git clone https://github.com/nltk/nltk_data.git ~/.local/nltk_data Link nltk_data ln -sf ~/.local/nltk_data/packages ~/nltk_data Unzip cd ~/nltk_data/path unzip xx.zip

April 18, 2023 · 1 min · Gray King

Bash

tags: Linux

April 17, 2023 · 1 min · Gray King

Bash scripting cheatsheet

tags: Cheatsheet, Bash source: Devhints.io cheatsheets. “Bash Scripting Cheatsheet.” Accessed April 17, 2023. https://devhints.io/bash.

April 17, 2023 · 1 min · Gray King

Searchable Linux Syscall Table for x86 and x86_64

tags: Cheatsheet, Linux source: “Searchable Linux Syscall Table for X86 and X86_64 | PyTux.” Accessed April 17, 2023. https://filippo.io/linux-syscall-table/.

April 17, 2023 · 1 min · Gray King

Starcoin Signing Message

tags: Starcoin Web3 StarTrek, Sign Message Invocation Path Dapp request personal_sign1 const msg = `0x${Buffer.from(exampleMessage, 'utf8').toString('hex')}` console.log({ msg }) const networkId = networkDiv.innerHTML const extraParams = { networkId } const sign = await window.starcoin.request({ method: 'personal_sign', // params: [msg, from, 'Example password'], // extraParams = params[2] || {}; means it should be an object: // params: [msg, from, { pwd: 'Example password' }], params: [msg, from, extraParams], }) Starmask handling request signPersonalMessage keyringController.signPersonalMessage(cleanMsgParams) 2 , 3 3 types of keyring:4 SimpleKeyring.signPersonalMessage HdKeyring.signPersonalMessage HdKeyringAptos.signPersonalMessage utils.signedMessage.generateSignedMessage5 ...

April 12, 2023 · 2 min · Gray King

pyenv

tags: Python

April 11, 2023 · 1 min · Gray King

Speedup Python Installation of pyenv

tags: Python, pyenv export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1 export PYTHON_BUILD_MIRROR_URL="https://mirrors.huaweicloud.com/python/"

April 11, 2023 · 1 min · Gray King

Aptos Signing Message

tags: Sign Message The starmask has implemented about signing message of APTOS.

April 11, 2023 · 1 min · Gray King

Pyright Type Stubs

tags: Python, LSP source: https://emacs-lsp.github.io/lsp-pyright/#usage-notes Download Default Type Stubs git clone https://github.com/microsoft/python-type-stubs $HOME/.local/src/python-type-stubs Use it in Emacs (setq lsp-pyright-stub-path (concat (getenv "HOME") "/.local//src/python-type-stubs")) ;; example Add Django Type Stubs git clone git@github.com:typeddjango/django-stubs.git ~/.local/src/django-stubs ln -sf ~/.local/src/django-stubs/django-stubs ~/.local/src/python-type-stubs/django Add Celery Type Stubs git clone https://github.com/sbdchd/celery-types ~/.local/src/celery-types ln -sf ~/.local/src/celery-types/amqp-stubs ~/.local/src/python-type-stubs/amqp ln -sf ~/.local/src/celery-types/billiard-stubs ~/.local/src/python-type-stubs/billiard ln -sf ~/.local/src/celery-types/celery-stubs ~/.local/src/python-type-stubs/celery ln -sf ~/.local/src/celery-types/django_celery_results-stubs ~/.local/src/python-type-stubs/django_celery_results ln -sf ~/.local/src/celery-types/ephem-stubs ~/.local/src/python-type-stubs/ephem ln -sf ~/.local/src/celery-types/kombu-stubs ~/.local/src/python-type-stubs/kombu ln -sf ~/.local/src/celery-types/vine-stubs ~/.local/src/python-type-stubs/vine

April 10, 2023 · 1 min · Gray King

jemalloc

tags: Memory Management, Heap Fragmentation

April 7, 2023 · 1 min · Gray King

Memory Management

tags: Memory Model

April 7, 2023 · 1 min · Gray King

Heap Fragmentation

tags: Memory Management

April 7, 2023 · 1 min · Gray King

Spotting and Avoiding Heap Fragmentation in Rust Applications

tags: Heap Fragmentation, jemalloc source:Svix Blog. “Spotting and Avoiding Heap Fragmentation in Rust Applications,” April 4, 2023. https://www.svix.com/blog/heap-fragmentation-in-rust-applications/. Heap fragmentation cause stair-step memeory usage, use jemalloc to solve heap fragmentation.

April 7, 2023 · 1 min · Gray King

Sign Message

tags: Blockchain

April 7, 2023 · 1 min · Gray King

Tron Signing Data

tags: Tron, Sign Message Three methods tronweb.trx.signMessageV11 tronweb.trx.signMessageV22 tronweb.trx._signtypeddata3, 4 https://github.com/tronprotocol/tronweb/blob/859253856c79d3aff26ec6c89afefc73840d648d/src/lib/trx.js#L727-L739 ↩︎ https://github.com/tronprotocol/tronweb/blob/859253856c79d3aff26ec6c89afefc73840d648d/src/utils/message.js#L8-L18 ↩︎ https://github.com/tronprotocol/tronweb/blob/859253856c79d3aff26ec6c89afefc73840d648d/src/utils/crypto.js#L89 ↩︎ TIP 104 ↩︎

April 7, 2023 · 1 min · Gray King

Ethereum Signing Data

tags: Ethereum, Sign Message source: “Signing Data | MetaMask Docs.” Accessed April 6, 2023. https://docs.metamask.io/guide/signing-data.html#signtypeddata-v4. Five Methods1 eth_sign allow to sign arbitrary hash.2 personal_sign add prefix to data and human readable text that encoded UFT-8.3 signTypedData or signTypedData_v1 first release that lacked some later security improvements. signTypedData_v3 signTypedData_v4 compatible with V3. Differences Between V3 and V44 Some input types that V3 doesn’t support but V4 does: Custom type array Custom type with null input Some input types that V4 doesn’t support but V3 does: ...

April 6, 2023 · 1 min · Gray King

Use GDB to Debug Cgo Segmentation Fault

tags: Go, GDB Enable Core Dumps ulimit -S -c unlimited Confirm or Change The Location of Core Dumps sysctl -w kernel.core_pattern=/tmp/core.%e.%p # Or echo '/tmp/core.%e.%p' | tee /proc/sys/kernel/core_pattern Set GOTRACEBACK Environment Variable to Let Go Program Core Dumps when Panic export GOTRACEBACK=crash Run Go Program and Wait Segmentation Fault Use GDB to Debug gdb /path/to/goprogram /tmp/core-xx-xx Then use thread apply all bt to see all backtraces, include compiled C code. Note: -g option should be applied to the compiled C code to generate debug symbols. ...

April 5, 2023 · 1 min · Gray King

ScrollL2: How to Caculate L1Fee

tags: Ethereum Layer 2 Background You may meet the below error when you’re trying to transfer all your ETH from one address to another address: invalid transaction: insufficient funds for l1fee + gas * price + value The reason is that the Layer 1 fee are included in Scroll’s gas fee system, but the wallet only exclude the Layer 2 gas fee to do so when you transfer all your ETH. 1 ...

March 23, 2023 · 2 min · Gray King