Skip to content

Instantly share code, notes, and snippets.

@shirotech
shirotech / contractActions.ts
Last active August 11, 2024 18:49
This function is used to extend any `viem` client that will add a `getContract` function, and supports calling `read`, `write`, `simulate` with `inputs` and `outputs` objects mapping contract ABI rather than tuples.
import type { AbiParameterKind, ExtractAbiFunction } from "abitype";
import type {
Abi,
AbiParameterToPrimitiveType,
Account,
Address,
Chain,
Client,
ContractFunctionArgs,
ContractFunctionName,
@ether-wan
ether-wan / overrideBalance.ts
Last active August 1, 2024 20:54
Override ERC-20 balance for an address using Viem & simulateContract
import { createPublicClient, keccak256, numberToHex, pad, toHex, erc20Abi } from "viem";
import { mainnet } from 'viem/chains'
const publicClient = createPublicClient({
chain: mainnet,
transport: http()
});
const overrideBalance = async (balanceSlotIndex : number, walletToOverride : `0x${string}`, newBalanceAmount : bigint, tokenAddress : string) => {
// Convert the address to a 32-byte hex string
@dmpanch
dmpanch / howto_create_online_radio_macos_sierra.txt
Last active June 30, 2024 06:14
How to create internet radio on MacOS Sierra 10.12
All actions are performed in Terminal.app.
1. Install Homebrew http://brew.sh/
2. Install Jack (route audio tool) http://jackaudio.org/. Current stable version from official website doesn't work with
MacOS Sierra (I use 10.12.3) so you need to download beta version from there https://yadi.sk/d/JwT10b7v3Dm5yy.
After installing reboot your computer.
3. Install Darkice (audio streamer) via brew.
@Vestride
Vestride / encoding-video.md
Last active August 27, 2024 16:19
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@haswalt
haswalt / .gitconfig
Created February 4, 2013 18:00
My global git config
[user]
name = Harry Walter
email = ***********
[branch "master"]
remote = origin
merge = refs/heads/master
[color]
diff = auto
@christophermanning
christophermanning / README.md
Last active March 30, 2023 04:24
Voronoi Diagram with Force Directed Nodes and Delaunay Links

Created by Christopher Manning

Summary

Nodes are linked to nodes in neighboring cells. The cell's color is a function of its area.

The white lines are the Delaunay triangulation and the purple cells are the Voronoi diagram.

Controls