Skip to content

Instantly share code, notes, and snippets.

@cheekybastard
cheekybastard / ur-prompt.md
Created September 23, 2026 09:11 — forked from minimaxir/ur-prompt.md
ur-prompt-20260919

Optimize the Rust and Python bindings in this Rust crate to its maximum potential. Specifically, you MUST make a breakthrough from this current implementation that uses modern concepts and knowledge as of 2026 to further improve this crate without causing ANY significant regressions.

First, before making any library changes, run the Rust and Python benchmarks (and any competitor benchmarks if applicable) to establish a True Performance Baseline for both speed and metric performance. Return the absolute and relative results to the True Performance Baseline to the user as a Markdown table.

Then, optimize the Rust and Python library code such that these benchmarks are atleast 1.2x faster from the True Performance Baseline; ideally as fast as possible, without any significant regressions on quality and prediction error. NEVER hack the benchmarks to accomplish this speed increase, only iterate on the library code. Ensure all benchmark iterations are independent, e.g. NEVER reuse a cache built in

>>> yswap = Contract.from_explorer('0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51')
>>> yusd = Contract.from_explorer('0x5dbcF33D8c2E976c6b560249878e6F1491Bca25c')
>>> ycrv = Contract.from_explorer('0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8')
# coins are 0 = idai, 1 = iusdc, 2 = iusdt, 3 = itusd
# underlying coins are 0 = dai, 1 = usdc, 2 = usdt, 3 = tusd
# this gets us the i-counterparts which also sit in money markets
>>> coins = [Contract.from_explorer(yswap.coins(i)) for i in range(4)]
>>> dec = [10 ** coin.decimals() for coin in coins]
[1000000000000000000, 1000000, 1000000, 1000000000000000000]
from brownie import accounts, chain, Contract, Wei
from eth_abi.packed import encode_abi_packed
user = accounts[0]
weth = Contract('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', owner=user)
dai = '0x6B175474E89094C44Da98b954EedeAC495271d0F'
rai = '0x03ab458634910AaD20eF5f1C8ee96F1D6ac54919'
# https://github.com/Uniswap/uniswap-v3-periphery/blob/main/deploys.md
quoter = Contract('0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6')
// https://rxjs.dev/api
const { from, timer } = require('rxjs');
const { last, map, catchError, switchMap } = require('rxjs/operators');
// https://danfo.jsdata.org/
const dfd = require('danfojs-node');
let latestBlocktime = 2.2;
function getBlocktime() {
return from(dfd.readCSV('https://polygonscan.com/chart/blocktime?output=csv')).pipe(
import httpx
import cytoolz as tz # type: ignore
from cytoolz import curried as c # type: ignore
black_list_crypto: list = ['FTT', 'SOL', 'CHZ', 'BNT', 'SUSHI']
COLLATERAL: int = 1500
BASE_SPREAD: float = 0.0025
gtrade_trading_vars: dict = httpx.get("https://gains-farm-v2-mainnet.herokuapp.com/trading-variables").json()
FROM_SYMBOLS_ALL: list = [x['from'] for x in gtrade_trading_vars['pairs']]
@cheekybastard
cheekybastard / EVM_Regex_Decompiler.md
Created December 29, 2022 02:03 — forked from vicnaum/EVM_Regex_Decompiler.md
EVM Regex Decompiler
"""
pip install httpx orjson websockets loguru chime
to run:
python -u "<folder_path>/wss_logger.py"
"""
import sys
import asyncio
import httpx
I contributed to the Semaphore Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: semaphore16
Contributor # 182
Hash: aaf3a1da 5881ccef 2947e06c 6b79febf
eb07c335 9e34cd10 60f57ea7 39e446a2
11d3df5e b024ce28 bef24ee4 293307eb
7b562eec e4df87b3 fab92b8a 2126610e
@cheekybastard
cheekybastard / scrapy_plus_selenium_renderedpage
Created February 13, 2013 14:17
Using Scrapy with Selenium to scape a rendered page
#Using Scrapy with Selenium to scape a rendered page [Updated]
from scrapy.contrib.spiders.init import InitSpider
from scrapy.http import Request, FormRequest
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from selenium import selenium
@cheekybastard
cheekybastard / reddit_scrape.py
Created March 17, 2013 05:19
reddit scraper
#!/usr/local/bin/python
'''
Date July 4, 2012
Author: Justin Jessup
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Disclaimer:
All software provided as is. All software covered under the GPL license and free for public redistribution.