Skip to content

Instantly share code, notes, and snippets.

@elyase
elyase / weth_logs_example.py
Created February 27, 2025 11:30
Example of how to fetch and join raw tables in cherry
import asyncio
import cherry_core
import polars as pl
import pyarrow as pa
import pyarrow.compute as pc
from cherry_core import ingest
from pyarrow import RecordBatch
# Configuration for teaching purposes
@elyase
elyase / polymarket_order_book.py
Last active February 25, 2025 12:26
Fetch orderbook data from polymarket
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "requests",
# ]
# ///
import requests
def main():
This file has been truncated, but you can view the full file.
# API reference
The API reference contains detailed descriptions of all public functions and objects. It's the best
place to look if you need information on a specific function.
## Python
The Python API reference is built using Sphinx. It's available in
[our docs](https://docs.pola.rs/api/python/stable/reference/index.html).
@elyase
elyase / r1.py
Created January 26, 2025 12:25 — forked from vgel/r1.py
script to run deepseek-r1 with a min-thinking-tokens parameter, replacing </think> with a random continuation string to extend the model's chain of thought
import argparse
import random
import sys
from transformers import AutoModelForCausalLM, AutoTokenizer, DynamicCache
import torch
parser = argparse.ArgumentParser()
parser.add_argument("question", type=str)
parser.add_argument(
import asyncio
import base64
import json
import os
import pyaudio
from websockets.asyncio.client import connect
class SimpleGeminiVoice:
def __init__(self):
@elyase
elyase / .cursorrules.md
Created November 7, 2024 12:12 — forked from bossjones/.cursorrules.md
cursor rules generated with the help of sonnet 3.5

Python Development Assistant Prompt System

Version Control

version: 1.0.0
last_updated: 2024-03-19
sections:
  - core_requirements
  - python_version
 - code_style
@elyase
elyase / Cargo.toml
Created May 14, 2024 11:19 — forked from kallydev/Cargo.toml
Alloy log subscriber.
[package]
name = "playground"
version = "0.1.0"
edition = "2021"
[dependencies]
alloy = { git = "https://github.com/alloy-rs/alloy.git", features = ["contract", "provider-ws", "rpc-types-eth"] }
anyhow = "1.0.82"
tokio = { version = "1.37.0", features = ["full"] }
tracing = "0.1.40"
@elyase
elyase / simulate_swap.py
Last active May 5, 2024 11:59
Swap simulation with pyrevm
from eth_abi import decode, encode
from eth_utils import function_signature_to_4byte_selector
from pyrevm import EVM
# https://etherscan.io/tx/0x652bae3b1c11fbcf64309c2dfec5537b9bd1d3f2b521176f71ba1115a313ecbd"
# Swap 0.031485012992133186 ETH for 1,110.686711078457978839 CSWAP on Uniswap v2
block_number = 19726294
caller = "0xc0170e050355408e53800d093f3f13c3a53b29c8"
router = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
token = "0xae41b275aaAF484b541A5881a2dDED9515184CCA"
@elyase
elyase / abi.py
Created January 18, 2024 11:26 — forked from reinforcementwonder/abi.py
uniswap v2 buy & sell
import json
MIN_ERC20_ABI = json.loads(
"""
[{"constant": true, "inputs": [], "name": "name", "outputs": [ { "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_spender", "type": "address" }, { "name": "_value", "type": "uint256" } ], "name": "approve", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_from", "type": "address" }, { "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "decimals", "outputs": [ { "name"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.