View getEtherscanLogs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getEtherscanLogs (chain: string, fromBlock: number, toBlock: number, address: string, topic0: string, topic1?: string) { | |
const baseUrl = 'https://api-goerli.etherscan.io' | |
let url = `${baseUrl}/api?module=logs&action=getLogs&address=${address}&fromBlock=${fromBlock}&toBlock=${toBlock}&topic0=${topic0}&page=1&offset=0&apikey=YourApiKeyToken` | |
if (topic1) { | |
url += `&topic0_1_opr=and&topic1=${topic1}` | |
} | |
const res = await fetch(url) | |
const json = await res.json() | |
const logs = json.result | |
return logs |
View getEtherscanTxs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getEtherscanTxs(chain: string, accountAddress: string) { | |
const baseUrl = 'https://api-goerli.etherscan.io' | |
const url = `${baseUrl}/api?module=account&action=txlist&address=${accountAddress}&startblock=0&endblock=99999999&sort=asc&apikey=YourApiKeyToken` | |
const res = await fetch(url) | |
const json = await res.json() | |
const txs = json.result | |
const txHashes = txs.map((tx: any) => tx.hash) | |
return txHashes | |
} |
View batchFetch.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function batchFetch (contract: Contract, filter: any, startBlockNumber: number, endBlockNumber: number, batchSize = 10000) { | |
const logs: any[] = [] | |
let start = startBlockNumber | |
let end = Math.min(start + batchSize, endBlockNumber) | |
while (end <= endBlockNumber) { | |
const _logs = await contract.queryFilter( | |
filter, | |
start, | |
end | |
) |
View instructions.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman -S csview |
View urls.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'https://rpc.ankr.com/optimism', | |
'https://optimism.blockpi.network/v1/rpc/public', | |
'https://opt-mainnet.g.alchemy.com/v2/demo', | |
'https://optimism-mainnet.public.blastapi.io', | |
'https://api.zan.top/node/v1/opt/mainnet/public', | |
'https://optimism.publicnode.com', | |
'https://optimism.meowrpc.com', | |
'https://mainnet.optimism.io', | |
'https://rpc.optimism.gateway.fm', | |
'https://gateway.tenderly.co/public/optimism', |
View removeOutliersByZScore.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeOutliersByZScore(data: number[], threshold = 2) { | |
const mean = data.reduce((acc, val) => acc + val, 0) / data.length | |
const stdDev = Math.sqrt(data.reduce((acc, val) => acc + Math.pow(val - mean, 2), 0) / data.length) | |
return data.filter((val) => Math.abs((val - mean) / stdDev) < threshold) | |
} |
View is_symlink.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test -L /tmp/somefile && echo true || echo false |
View server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cors from 'cors' | |
import express from 'express' | |
const app = express() | |
const port = process.env.PORT || 8000 | |
app.enable('trust proxy') | |
app.use(cors()) | |
app.use(express.json({ limit: '500kb' })) | |
app.use(express.urlencoded({ extended: false, limit: '500kb', parameterLimit: 50 })) |
View tmux.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`prefix+[` to enter copy mode | |
navigate to the start or the end of text selection with arrow keys | |
press `control+space` to start selection | |
move to opposite end of text to copy with arrow keys | |
press `control+w` to copy selected text | |
in the same tmux session, paste with `prefix+]`, to paste into vim, paste with prefix+] in vim insert mode |
View instructions.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-add -D |
NewerOlder