Skip to content

Instantly share code, notes, and snippets.

View jackcpku's full-sized avatar

Jack Cheng jackcpku

View GitHub Profile
@jboner
jboner / latency.txt
Last active July 3, 2024 14:57
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
package main
import (
"fmt"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
import "hashes/sha256/1024bitPadded.code" as sha256
import "ecc/edwardsScalarMult.code" as scalarMult
import "ecc/edwardsAdd.code" as add
import "utils/pack/unpack256.code" as unpack256
import "ecc/edwardsOnCurve.code" as onCurve
import "ecc/edwardsOrderCheck.code" as orderCheck
/// Verifies an EdDSA Signature.
///
/// Checks the correctness of a given EdDSA Signature (R,S) for the provided
Name Description On-chain Retrival Off-chain Retrieval
Creation Bytecode Code that generates the runtime bytecode type(ContractName).creationCode getTransactionByHash
Runtime Bytecode Code that is stored on-chain that describes a smart contract extcodecopy(a) or type(ContractName).runtimeCode getCode
Bytecode Umbrella term that encompasses both runtime bytecode and creation bytecode NA NA
Deployed Bytecode Same as runtime bytecode extcodecopy(a) or type(ContractName).runtimeCode getCode
Init Code Same as creation bytecode type(ContractName).creationCode getTransactionByHash
@LearnWebCode
LearnWebCode / index.js
Created July 21, 2021 23:41
Puppeteer / Node.js Automation & Web Scraping Tutorial from YouTube
// in a new folder be sure to run "npm init -y" and "npm install puppeteer"
const puppeteer = require("puppeteer")
const fs = require("fs/promises")
async function start() {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto("https://learnwebcode.github.io/practice-requests/")
const names = await page.evaluate(() => {