Skip to content

Instantly share code, notes, and snippets.

View sambacha's full-sized avatar
:atom:

sam bacha sambacha

:atom:
View GitHub Profile

Your is the single biggest render-blocking part of your page—ensuring it is well-formed is critical. ct.css is a diagnostic CSS snippet that exposes potential performance issues in your page’s tags.

Drag and drop the following link to your bookmarks bar (or click for simple demo): ct.css.

@VictorTaelin
VictorTaelin / towards_an_optimal_computer.md
Last active April 3, 2025 05:44
Higher-Order Company: Towards an Optimal Computer

Higher-Order Company: Towards an Optimal Computer

What is the true nature of computation?

A hundred years ago, humanity answered that very question, twice. In 1936, Alan invented the Turing Machine, which, highly inspired by the mechanical trend of the 20th century, distillated the common components of early computers into a single universal machine that, despite its simplicity, was capable of performing every computation conceivable. From simple numerical calculations to entire

@TriceHelix
TriceHelix / linux_evdev_capabilities.md
Last active March 29, 2025 07:25
Decoding Input Device (evdev) Capabilities on Linux (alternative to EVIOCGBIT ioctl)

Decoding Input Device (evdev) Capabilities on Linux

Introduction

Input devices (whether physically present, or emulated) may produce any "kind" of input. In other words there is no clear distinction between a keyboard and a mouse, other than the data they (i.e., their drivers) write to their corresponding /dev/input/eventX file (where X is an integer). That can be problematic sometimes, for example if a program in userspace consumes input data from a device and expects that data to only contain certain keycodes, event types, etc. Another example could be a video game which displays different sprites/text when a gamepad is used instead of a keyboard, like key/button prompts in a tutorial or a settings menu. Luckily, most devices only write a strict set of event types and codes to their eventX file, because well, most hardware is only a keyboard, or mouse, or gamepad, or touchscreen, etc. and not a wild combination. The kernel calls these the input device's capabilities, as documented [here](ht

@martin-mael
martin-mael / flexoki-tailwind-colors.ts
Created October 8, 2023 02:07
Flexoki Tailwind colors
// Tailwind colors for Flexoki theme by Steph Ango. https://stephango.com/flexoki
const colors = {
base: {
black: '#100F0F',
950: '#1C1B1A',
900: '#282726',
850: '#343331',
800: '#403E3C',
700: '#575653',

Trying Ezno checking today

This a short overview of some of the things you can do with Ezno today. If you find any problems, file an issue.

The following examples show some errors that have been caught using type checking, partial/const evaluation and effects.

To get started we will install oxidation-compiler which has bindings for Ezno's checker. (you can also get the binary from the releases page).

npm install -g oxidation-compiler@latest
@taarushv
taarushv / mev.js
Last active January 26, 2024 09:16
Analyzing backrun/rebate in txs 0/1/2 in https://etherscan.io/block/17358588
// TX 1 - Admin wallet enables trading on FCKIT token https://etherscan.io/tx/0x12b949cf5605bb4da83efd14b6d38ad628a9ebf3befb42141d2ddb8cfc43d53e
// TX 2 - Searcher uses a proxy contract to buy ~2B FCKIT --for 60 ETH-- into multiple wallets (and to pay builder for gas fees/rebate) https://etherscan.io/tx/0xc3a37580a96b52a718a5b516dfef209f150e87a75032c725536821ea0d6cc875
// TX 3 - Rebate is forwarded from the flashbots builder back to the user https://etherscan.io/tx/0x80dc2721d833cd221bdf9264f1138a88907f57303bc606f8ee4034297201e095
const { ethers } = require('ethers'); // v5
const rpc = "https://mainnet.infura.io/v3/YOUR_API_KEY_HERE"
const provider = new ethers.providers.JsonRpcProvider(rpc)
// uni v2 router, to fetch trades using logs
const uniPool ="0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
@recmo
recmo / keccak-aarch64.rs
Last active October 17, 2023 23:17
Rust aarch64 FEAT_SHA3 implementation of keccak_f1600.
#![cfg(all(target_arch = "aarch64", target_feature = "sha3"))]
use core::arch::asm;
const RC: [u64; 24] = [
0x0000000000000001,
0x0000000000008082,
0x800000000000808a,
0x8000000080008000,
0x000000000000808b,
0x0000000080000001,
@engn33r
engn33r / vulncreate2detector.sh
Last active December 26, 2023 22:44
Detect contracts vulnerable to CREATE2 manipulation
#!/bin/bash
# This script is a hacked together PoC, don't trust it to work well
# For proper detection of vulnerable contracts, recursive testing must be performed because CREATE2 in a contract's ancestry could be problematic: https://medium.com/@jason.carver/defend-against-wild-magic-in-the-next-ethereum-upgrade-b008247839d2#3f90
# Improved tool and full research coming from yAcademy next month: https://twitter.com/yAcademyDAO
contract_addr="0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852" # default value is a uniswap V2 pair from https://v2.info.uniswap.org/pairs
etherscan_api_key=""
if [[ -z "$etherscan_api_key" ]]; then
@ttesmer
ttesmer / AD.hs
Last active October 29, 2024 15:35
Automatic Differentiation in 38 lines of Haskell using Operator Overloading and Dual Numbers. Inspired by conal.net/papers/beautiful-differentiation
{-# LANGUAGE TypeSynonymInstances #-}
data Dual d = D Float d deriving Show
type Float' = Float
diff :: (Dual Float' -> Dual Float') -> Float -> Float'
diff f x = y'
where D y y' = f (D x 1)
class VectorSpace v where
zero :: v
# ▇ => ▇ + ▇
# Minimal runtime bytecode for a contract that mutates
# into two child contracts and then self-destructs
# 1st child contract receives the call value
# 2nd child contract recevies the remaining balance
# author: Saw-mon and Natalie
# constructor payload for the spawned contract
# ┏━━━━━━━━━━━━━━━━━━━ push1 RUNTIME_BYTECODE_LEN # L