Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Add Quick Calculations to Uniswap
// @namespace http://tampermonkey.net/
// @version 0.6.0
// @description Add quick links on uniswap, similar to trading interfaces
// @author Korkey128k
// @match https://app.uniswap.org/
// @match https://uniswap.hedron.pro/*
// @match https://*.pulsex.com/*
// @icon https://www.google.com/s2/favicons?domain=uniswap.org
@mitchellh
mitchellh / RadixTrees.tla
Last active September 8, 2025 00:01
Radix tree and validation in TLA+
This module contains operations for working with radix trees. A radix tree
is a data structure for efficient storage and lookup of values that often
share prefixes, typically used with strings.
A common question when I show this to people is: how do I add to the tree?
delete? update? For these, grab the Range of the tree, use set logic to
add/remove any elements, and construct a new tree with RadixTree.
For educational purposes, I've heavily commented all the operations. I
recommend using the constant expression evaluator to try the building blocks
@ptc-mrucci
ptc-mrucci / unit.sh
Last active August 20, 2025 15:47 — forked from tvlooy/unit.sh
Bash test: get the directory of a script
#!/bin/bash
python3 --version || { echo "ERROR: Missing python3"; exit 1; }
tmp=$(python3 -c "import os, sys; print(os.path.realpath('/tmp'))")
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
@Tugzrida
Tugzrida / mta-sts.js
Last active October 22, 2025 14:28
MTA-STS Cloudflare worker
// This worker is designed to be able to neatly handle MTA-STS policies for multiple domains.
// Make a new worker with this script and add your domains to the stsPolicies dict like the example.
// Add a DNS AAAA record for mta-sts.yourdomain.com pointing to 100:: and set to proxied,
// then add a workers route for mta-sts.yourdomain.com/* pointing to this worker.
// You should probably also create a Cloudflare configuration rule disabling Browser Integrity Check for the mta-sts subdomain
// to ensure MTAs aren't blocked from retrieving your policy.
// You'll still need to manually add the appropriate _mta-sts.yourdomain.com TXT record to enable the policy,
@justjake
justjake / server-preload.js
Last active July 8, 2025 16:50
Customizing NextJS for error reporting and Datadog APM (dd-trace) integration. See https://jake.tl/notes/2021-04-04-nextjs-preload-hack
// @ts-check
"use strict"
/**
* Set up datadog tracing. This should be called first, so Datadog can hook
* all the other dependencies like `http`.
*/
function setUpDatadogTracing() {
const { tracer: Tracer } = require('dd-trace')
const tracer = Tracer.init({
@yorickdowne
yorickdowne / GethBEHAVE.md
Last active January 17, 2025 17:36
Pruning Geth 1.10.x, 1.11.x, 1.12.x

Note: PBSS in Geth >=1.13.0 removes the need to prune manually.


Old content for reference

Overview

Geth (Go-Ethereum) as of July 2022 takes about 650 GiB of space on a fast/snap sync, and then grows by ~ 14 GiB/week with default cache, ~ 8 GiB/week with more cache.

@101arrowz
101arrowz / crc32.js
Last active February 26, 2025 14:45
Fast CRC32 in JavaScript
/**!
* Fast CRC32 in JavaScript
* 101arrowz (https://github.com/101arrowz)
* License: MIT
*/
// If you use this code, please link this gist or attribute it somehow.
// This code uses the Slice-by-16 algorithm to achieve performance
// roughly 2x greater than all other JS CRC32 implementations (e.g.
@sindresorhus
sindresorhus / esm-package.md
Last active October 31, 2025 00:11
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.

GitHub Actions

source: actions/runner-images#599

Use NPM_CONFIG_PREFIX - docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

export NPM_CONFIG_PREFIX=~/.npm-global
npm install -g lerna