Skip to content

Instantly share code, notes, and snippets.

View jmcph4's full-sized avatar

Jack McPherson jmcph4

View GitHub Profile
@jmcph4
jmcph4 / ref.md
Last active March 12, 2025 21:43
1. https://datatracker.ietf.org/doc/html/rfc8949
2. https://docs.soliditylang.org/en/v0.8.28/metadata.html
3. https://raw.githubusercontent.com/ipfs/papers/master/ipfs-cap2pfs/ipfs-p2p-file-system.pdf
4. https://www.ethswarm.org/swarm-whitepaper.pdf
5. https://www.ethswarm.org/The-Book-of-Swarm.pdf
6. https://arxiv.org/pdf/2205.14927
7. https://old.reddit.com/r/ipfs/comments/15y9orp/nodes_number_of_ipfs_nodes_and_the_most_popular
import re
import cbor2
import argparse
from base58 import b58encode
def extract_ipfs_hash(bytecode: str) -> str:
"""
Extracts the IPFS hash from the CBOR-encoded metadata in Solidity bytecode.
"""
# Look for the CBOR metadata marker (0xa264...) at the end of the bytecode
#!/bin/bash
curl -X GET "https://api.llama.fi/protocols" | jq 'map(select(.category == "Dexs" and (.chainTvls | keys | length > 0)))
| map(.chains[] as $chain | { chain: $chain, dex: { name: .name, url: .url, tvl: .chainTvls[$chain] } })
| group_by(.chain)
| map({ (.[0].chain): map(.dex) })
| add'
diff --git a/examples/hyperliquid/examples/basis.rs b/examples/hyperliquid/examples/basis.rs
index 95e44d2..39ec0b2 100644
--- a/examples/hyperliquid/examples/basis.rs
+++ b/examples/hyperliquid/examples/basis.rs
@@ -1,8 +1,13 @@
-use std::env;
+use std::{env, time::Duration};
use float_ord::FloatOrd;
+use futures::{stream, StreamExt};
def ask_question(question, choices=None):
print(question)
if choices:
for i, choice in enumerate(choices, 1):
print(f"{i}. {choice}")
answer = input("Choose a number: ")
return choices[int(answer) - 1] if answer.isdigit() and 1 <= int(answer) <= len(choices) else None
else:
return input("Your answer: ")
digraph TensorFlow {
Tensor [shape = "rect"]
LazyBuffer [shape = "rect"]
LazyOp [shape = "rect"]
UOp [shape = "rect"]
Code [shape = "rect"]
"<computation>"
Tensor -> LazyBuffer [label = "Forward and backward passes occur here (`tinygrad/function.py`)"];
LazyBuffer -> LazyOp [label = "Breaking into kernels occurs here (`tinygrad/engine/schedule.py`)"];
import requests
from datetime import datetime
def get_contributions(username, start_date, end_date):
url = f'https://api.github.com/users/{username}/events'
start_date, end_date = map(lambda x: datetime.strptime(x, "%Y-%m-%d"), [start_date, end_date])
total_contributions = 0
page = 1
while True:
/* $ gcc tree.c -Wall -Wextra -Wshadow -std=c11 -pedantic -o tree */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
struct Vertex {
uint8_t data;
struct Vertex* left;
struct Vertex* right;

System Information

Version: 8ad7d05

$ uname -a
Linux [REDACTED] 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
$ reth --version
reth Version: 1.1.0
Commit SHA: 1ba631ba9581973e7c6cadeea92cfe1802aceb4a
Build Timestamp: 2024-10-10T18:21:22.096485546Z
[package]
name = "checkpoint"
version = "0.1.0"
edition = "2021"
[dependencies]
alloy = { version = "0.6", features = ["full"] }
amms = { git = "https://github.com/darkforestry/amms-rs.git", rev = "8ad7d05" }
eyre = "0.6.12"
tokio = { version = "1.42.0", features = ["full"] }