Skip to content

Instantly share code, notes, and snippets.

View jmcph4's full-sized avatar

Jack McPherson jmcph4

View GitHub Profile
#!/bin/bash
# Name of the program to monitor (provide the full path if not in PATH)
PROGRAM="your_program"
PROGRAM_ARGS="--arg1 --arg2" # Replace with the program's arguments
# Ensure the script is running as root to read dmesg
if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root to monitor OOM events."
exit 1
use arbitrary::{Arbitrary, Unstructured};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use ironlobe::{
book::{
btree_book::{BTreeBook, Metadata},
Book,
},
order::PlainOrder,
};
use rand::{thread_rng, RngCore, SeedableRng};

IEEE Citation Style Bibliography

[1] V. Buterin, "Proposer/Builder Separation (PBS) Spec," Ethereum Foundation, Jul. 2022. [Online]. Available: https://notes.ethereum.org/@vbuterin/proposer_builder_separation

[2] Flashbots, "Introducing MEV-Boost: Empowering Ethereum Stakers," Flashbots Blog, Jun. 2022. [Online]. Available: https://flashbots.net/blog/mev-boost-intro

[3] S. Gao, "A Survey on Maximal Extractable Value (MEV): Concepts, Techniques, and Future Directions," IEEE Access, vol. 10, pp. 78590–78605, Aug. 2022.

[4] S. Eskandari, J. Clark, M. Moeini, and M. Vasek, "SoK: MEV and Flash Loans: Threats and Mitigations," in Proceedings of the 2022 ACM SIGSAC Conference on Computer and Communications Security (CCS), Nov. 2022, pp. 1–18.

@jmcph4
jmcph4 / invert.hs
Last active October 12, 2024 11:23
import Data.Bits (shiftR, testBit)
import Numeric (showIntAtBase)
import Data.Char (intToDigit, digitToInt)
type Bit = Bool
-- | Non-empty, possibly infinite, binary tree
data Tree a = Node {
label :: a,
left :: Maybe (Tree a),
fn new_payload_job(
&self,
attributes: <Builder as PayloadBuilder<Pool, Client>>::Attributes,
) -> Result<Self::Job, PayloadBuilderError> {
panic!("KABOOM");
let parent_block = if attributes.parent().is_zero() {
// use latest block if parent is zero: genesis block
self.client
.block_by_number_or_tag(BlockNumberOrTag::Latest)?
.ok_or_else(|| PayloadBuilderError::MissingParentBlock(attributes.parent()))?
fn foo(x: &[f64], y: &[f64], out: &mut [f64]) {
if x.len() != y.len() || x.len() != out.len() {
return;
} else {
let n: usize = x.len();
for i in 0..n {
out[i] = x[i] * y[i];
}
}
[package]
name = "decoder"
version = "0.1.0"
edition = "2021"
[dependencies]
reth = { version = "1.0.6", git = "https://github.com/paradigmxyz/reth" }
alloy-rlp = { version = "=0.3.4", git = "https://github.com/alloy-rs/rlp", rev = "5fd8d81" }
@jmcph4
jmcph4 / aslr.c
Created September 9, 2024 04:14
In case some of you have forgotten how computers work!
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main(void) {
uint8_t x = 0xca;
uint8_t* p = &x;
printf("x = %d p = %p\n", x, p);
@jmcph4
jmcph4 / dataframe.py
Last active September 6, 2024 05:14
PyO3 recipes
use pyo3::prelude::*;
use pyo3::types::IntoPyDict;
fn main() -> PyResult<()> {
Python::with_gil(|py| {
let locals = [("pd", py.import_bound("pandas")?)].into_py_dict_bound(py);
let code = "pd.DataFrame({})";
let res = py.eval_bound(code, None, Some(&locals))?;
println!("{res:?}");
#!/bin/bash
curl http://localhost:8545 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"eth_callBundle","params":[{"txs":["0x123abc","0x456def"],"blockNumber":"0xb63dcd","stateBlockNumber":"latest","timestamp":1615920932}]}'