Skip to content

Instantly share code, notes, and snippets.

View fxfactorial's full-sized avatar
🎯
Focusing

@edgararout fxfactorial

🎯
Focusing
View GitHub Profile
@fxfactorial
fxfactorial / extract_top_peers.py
Created February 4, 2022 02:47 — forked from bogatyy/extract_top_peers.py
Extract top peers
from collections import defaultdict
GETH_LOGFILE = 'geth-log.txt'
def extract_parameter(source_str, before_str, after_str):
start_pos = source_str.find(before_str) + len(before_str)
return source_str[start_pos:source_str.find(after_str, start_pos)]
@fxfactorial
fxfactorial / ECDSA.sol
Created January 28, 2022 18:45 — forked from BjornvdLaan/ECDSA.sol
Verification of externally created ECDSA signatures in Solidity
pragma solidity ^0.4.24;
contract ECDSA {
function verify() public returns (bool) {
bytes32 message = ethMessageHash("TEST");
bytes memory sig = hex"bceab59162da5e511fb9c37fda207d443d05e438e5c843c57b2d5628580ce9216ffa0335834d8bb63d86fb42a8dd4d18f41bc3a301546e2c47aa1041c3a1823701";
address addr = 0x999471bb43b9c9789050386f90c1ad63dca89106;
@fxfactorial
fxfactorial / StableSwapAaveGetter.sol
Created December 2, 2021 16:56
StableSwapAaveGetter contract mock up
pragma solidity ^0.7.6;
interface IStableSwapAave {
function A_precise() external view returns (uint256);
function balances(uint256 i) external view returns (uint256);
function underlying_coins(uint256 arg0) external view returns (address);
function admin_balances(uint256 arg0) external view returns (uint256);
@fxfactorial
fxfactorial / eth_call.js
Created October 14, 2021 13:04 — forked from RomanFro/eth_call.js
eth_call
'use strict';
const WEB3_URL = process.env.WEB3_URL;
const prom = require('util').promisify;
const ethABI = require('ethereumjs-abi');
const Web3 = require('web3');
const provider = new Web3.providers.HttpProvider(WEB3_URL);
const web3 = module.exports = new Web3(provider);
const sendAsync = prom(web3.currentProvider.sendAsync).bind(web3.currentProvider);
@fxfactorial
fxfactorial / cgo.md
Created August 26, 2021 21:07 — forked from zchee/cgo.md
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.

@fxfactorial
fxfactorial / decode_example.js
Created August 15, 2021 00:29 — forked from miguelmota/decode_example.js
JavaScript decode RLP encoded Ethereum transaction (raw transaction) examples
// RLP encoded transaction
const rawTxHex = '0xed8205fc843b9aca00825208944592d8f8d7b001e72cb26a73e4fa1806a51ac79d88016345785d8a000080808080'
// using rlp package to decode values
const rlp = require('rlp')
const decoded = rlp.decode(rawTxHex)
console.log(decoded)
/*
[ <Buffer 05 fc>,
<Buffer 3b 9a ca 00>,
@fxfactorial
fxfactorial / eth-benchmark.py
Created July 16, 2021 02:30 — forked from easeev/eth-benchmark.py
Ethereum node query performance benchmark
import timeit
import threading
import asyncio
import contextlib
import requests
from aiohttp import ClientSession
from web3.providers.base import JSONBaseProvider
from web3.providers import HTTPProvider
@fxfactorial
fxfactorial / faucet.js
Created July 4, 2021 00:58
suck faucets
const puppeteer = require('puppeteer');
const spawn = require('@expo/spawn-async');
const v4 = require('uuid').v4;
const UserAgent = require('user-agents');
const faucet = 'https://explorer.certik.foundation/faucet';
const address_query = 'input[name=address]';
const button_click = 'form button[type=submit]';
type Point struct {
GasPriceX *big.Int
EthProfitY *big.Int
}
func (b *Bot) MaxProfitPossible(p1, p2 Point) *big.Int {
rise := new(big.Int).Sub(p2.EthProfitY, p1.EthProfitY)
run := new(big.Int).Sub(p2.GasPriceX, p1.GasPriceX)
slope := new(big.Float).Quo(
new(big.Float).SetInt(rise),