Skip to content

Instantly share code, notes, and snippets.

// evm.ts
// —— Helpers ———————————————————————————————————————————————
type U256 = bigint;
// bytes → bigint via hex string
function fromBytes(bytes: Uint8Array): U256 {
const hex = [...bytes].map(b => b.toString(16).padStart(2, '0')).join('');
return BigInt('0x' + hex);
@zenware
zenware / potato_leek_soup.md
Created January 28, 2025 23:44
Recipe - Potato Leek Soup

Potato Leek Soup

Ingredients

Main Ingredients

Name Quantity
Yukon Gold Potatoes 2.5 lbs.
Leeks 2 large 
@OrionReed
OrionReed / dom3d.js
Last active June 27, 2025 05:23
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@dwf
dwf / flake.nix
Created January 2, 2024 00:33
Minimal example of YAML as flake output
# Copyright 2024 Google LLC.
# SPDX-License-Identifier: Apache-2.0
{
description = "Demo of generating a YAML file as a flake output";
outputs = { self, nixpkgs }: let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in {
packages = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
@prestwich
prestwich / monorepo.md
Last active November 25, 2022 17:15
How to break up a monorepo :)

How to break up a monorepo using git subtree:

  1. Set up some basic stuff:
    • These should be independent, not nested
$ NEW_REPO_PATH=
$ OLD_REPO_PATH=

2023:

  1. A Brief History of Commercial Capitalism - Banaji

Started / Continuing

  • The Price of Time - Chancellor

2022:

  1. Making Money - Christine Desan
@hrkrshnn
hrkrshnn / generic.org
Last active March 19, 2025 23:52
Some generic writeup about common gas optimizations, etc.

Upgrade to at least 0.8.4

Using newer compiler versions and the optimizer gives gas optimizations and additional safety checks for free!

The advantages of versions 0.8.* over <0.8.0 are:

  • Safemath by default from 0.8.0 (can be more gas efficient than some library based safemath).
  • Low level inliner from 0.8.2, leads to cheaper runtime gas. Especially relevant when the contract has small functions. For
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Token {
address public owner;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
string public symbol = "TOKEN";
uint256 public decimals = 18;
@andkon
andkon / archive.py
Last active March 5, 2021 19:37
Archive all posts on instagram
from instagram_private_api import Client, ClientCompatPatch
from instagram_private_api.errors import ClientError
username = ""
password = ""
api = Client(username, password) # have to disable 2fa
posts = []
user_feed = api.user_feed(api.authenticated_user_id, max_id="")
posts.extend(user_feed['items'])