Skip to content

Instantly share code, notes, and snippets.

@dpmabo
dpmabo / rho_1st_256.c
Created August 27, 2023 08:57 — forked from Hermann-SW/rho_1st_256.c
Pollard Rho with tortoise and hare algorithm for non-prime numbers (128bit input, 256bit arithmetic)
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <assert.h>
#include <time.h>
#include <sys/time.h>
#define UINT128_C(u) ((__uint128_t)u)
const __uint128_t UINT128_MAX = UINT128_C(UINT64_MAX)<<64 | UINT64_MAX;
@dpmabo
dpmabo / Callback.cpp
Created August 23, 2023 15:20 — forked from YukiSakamoto/Callback.cpp
Callback function via Cython
#include "Callback.hpp"
#include <iostream>
IntHolderCallback::IntHolderCallback(iMethod method, void *user_data)
{
this->_method = method;
this->_user_data = user_data;
}
int
@dpmabo
dpmabo / fast-web3-py-event-decoder.py
Created November 30, 2022 03:31 — forked from miohtama/fast-web3-py-event-decoder.py
Fast event fetcher and decoder for web3.py
"""Below is an example for faster JSON-RPC event fetcher.
It skips a lot of steps, like converting raw binary values to corresponding numbers (float, ints),
looking up ABI labels and building `AttributedDict` object.
The resulting Event dictitionary is generated faster, but harder to use and you need to know what you are doing.
"""
def _fetch_events_for_all_contracts(
@dpmabo
dpmabo / USDCTest.t.sol
Created October 3, 2022 04:15 — forked from saucepoint/USDCTest.t.sol
Faucet yourself some USDC in foundry tests
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
// author: saucepoint
// run with a mainnet --fork-url such as:
// forge test --fork-url https://rpc.ankr.com/eth
import "forge-std/Test.sol";
// temporary interface for minting USDC