Skip to content

Instantly share code, notes, and snippets.

View hayeah's full-sized avatar
🕳️
Focusing

blah blah hayeah

🕳️
Focusing
View GitHub Profile
0x00 0 STOP
0x01 3 ADD
0x02 5 MUL
0x03 3 SUB
0x04 5 DIV
0x05 5 SDIV
0x06 5 MOD
0x07 5 SMOD
0x08 8 ADDMOD
0x09 8 MULMOD
@hayeah
hayeah / gclone.sh
Last active December 26, 2022 07:17
shortcut to clone git repo to a `user/repo` path
: <<COMMENT
# Clone the repository with the default repository name
gclone https://github.com/balancer-labs/balancer-v2-monorepo
# Clone the repository with a custom repository name
gclone https://github.com/balancer-labs/balancer-v2-monorepo my-custom-name
# Clone the repository without ".git" suffix
gclone https://github.com/balancer-labs/balancer-v2-monorepo.git my-custom-name
@hayeah
hayeah / 4.3.md
Created January 25, 2018 01:55
yellopaper rewritten with source code references

4.3 The Block

The block in Ethereum is the collection of relevant pieces of information (known as the block header), together with information corresponding to the comprised transactions, and a set of other block headers that are known to have a parent equal to the present block’s parent’s parent (such blocks are known as uncles).

https://sourcegraph.com/github.com/ethereum/go-ethereum@479aa61f11724560c63a7b56084259552892819d/-/blob/core/types/block.go#L139

type Block struct {
	header       *Header
	uncles []*Header
@hayeah
hayeah / c-create-contract.sol.asm
Created October 17, 2017 09:15
c-create-contract.sol.asm
======= c-create-contract.sol:FooFactory =======
EVM assembly:
/* "c-create-contract.sol":44:150 contract FooFactory {... */
mstore(0x40, 0x60)
jumpi(tag_1, iszero(callvalue))
0x0
dup1
revert
tag_1:
tag_2:
@hayeah
hayeah / fomo.sol
Created August 6, 2018 07:30
fomo3d contract
pragma solidity ^0.4.24;
/**
* @title -FoMo-3D v0.7.1
* ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐
* │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐
* ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘
* _____ _____
* (, / /) /) /) (, / /) /)
* ┌─┐ / _ (/_ // // / _ // _ __ _(/
* ├─┤ ___/___(/_/(__(_/_(/_(/_ ___/__/_)_(/_(_(_/ (_(_(_
@hayeah
hayeah / gist:8e98cb08d1a12e87159d
Last active July 13, 2021 06:57
NodeJS Express 训练营课程安排

暖身周 (可选)

  • 写一个简单的 NPM package
  • 用 mocha 写测试
  • 用 CoffeeScript 写 NPM package
  • 实现 JS 类 (练习原型链)

第一周 - Connect Middleware

@hayeah
hayeah / upsert.js
Last active July 28, 2020 10:40
monkey patch knex.js for PostgreSQL 9.5 upsert
const BaseQueryCompiler = require("knex/lib/query/compiler");
/*
db = knex({
client: "pg",
connection: config.postgresURL,
debug: true,
});
upsertMonkeyPatch(db);
@hayeah
hayeah / lifepod.age
Created April 28, 2020 15:52
Life Pod
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNjcnlwdCA0RWZGbHRLZE5sbFVpUVRX
NFM4dnNRIDE4Cm94YW5nMTdSdjVjRVJhdlRNRDdPbVdySXRBRVhhT0FUMmhUTUtO
d0oveEUKLS0tIEYrQmVZbTNpSDc5S0VodjcwOWRlOXFLMXhoU3o0anZONDY2NXdy
b0tMdVUKTh5KSjzxdFrXWef3mgDJd7iJov2bqwqepm9W4U7G+I6axMtSn4rW3FoH
cbvF+bDXy3SpySSYT21Gz97oerPpsBtH3A9sxYJ3/wDeB0G27+mbl2v6mqtpdIAR
8j7rfwCDfRxg9Ot2FBTkg2f2ReRPw6ZEZ69gJJe1620Lj3WofaQp4gw6o3maDlPN
53fm7TbR5zVVGvOkYfNH2mbAhW0PKjOLRV+bBG254RW+RxToV4esb8IPXblX0mH/
2bsXl0M4kocNiK94UI/uGSlzmZNlRMMVrz9Mg/Km4Cz6cQALkqX45WY5W8mfQjb2
A7s/n/hui1Y7cf6SUmxhZxLsON0NgCc8JwdWVpnDFqrCj/WB5xIjQhhiQQOEhGI2
@hayeah
hayeah / gist:d312704cd62ef8d5ae5e8ca243128820
Created September 6, 2019 03:28
edgeware lock contract expire time
curl https://mainnet.infura.io/v3/$INFURA_TOKEN \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0","method":"eth_getStorageAt","params": ["'$CONTRACT_ADDRESS'", "0x01", "latest"],"id":1}'
@hayeah
hayeah / objc-msg-x86_64.c
Last active October 27, 2018 13:17
objective C objc_msgSend assembly
/*
* Copyright (c) 1999-2007 Apple Inc. All Rights Reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this