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

// 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(
@cheekybastard
cheekybastard / EVM_Regex_Decompiler.md
Created December 29, 2022 02:03 — forked from vicnaum/EVM_Regex_Decompiler.md
EVM Regex Decompiler
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']]
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
"""
pip install httpx orjson websockets loguru chime
to run:
python -u "<folder_path>/wss_logger.py"
"""
import sys
import asyncio
import httpx
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')
>>> 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]
@cheekybastard
cheekybastard / gist:17f5b67ea8db4137b8ed
Created July 16, 2014 03:03
Hidden Markov model example
#http://sujitpal.blogspot.com.au/2013/03/the-wikipedia-bob-alice-hmm-example.html
#http://en.wikipedia.org/wiki/Hidden_Markov_model
from __future__ import division
import numpy as np
from sklearn import hmm
states = ["Rainy", "Sunny"]
n_states = len(states)
# ========================================
# Testing n-gram analysis in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/test
curl -X PUT localhost:9200/test -d '
{
"settings" : {
"index" : {
"analysis" : {