Skip to content

Instantly share code, notes, and snippets.

@0xngmi
0xngmi / detect-push0-support.js
Created April 29, 2024 12:09
Detect chains that dont support PUSH0
async function detectPush0Support(rpcs) {
return (await Promise.all(rpcs.map(async rpc => {
try {
const res = await fetch(rpc, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"method": "eth_call",
@fabiospampinato
fabiospampinato / inspect.zsh
Last active April 20, 2024 23:37
Node.js inspect function and plugin for zsh
# INSPECT
function inspect () {
eval NODE_OPTIONS="--inspect-brk" $@
}
# INSPECT PLUGIN
# Toggles the "inspect " prefix upon double ESC key
function plugin-inspect () {
@hf02
hf02 / DOM3D.user.js
Last active March 29, 2024 03:57 — forked from OrionReed/dom3d.js
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// ==UserScript==
// @name 3D DOM viewer
// @namespace https://gist.github.com/hf02/2f2fb776ba233fd758af559b9de9e177
// @version 2024-03-27
// @description 3D DOM viewer
// @author OrionReed (forked by hf02)
// @match *://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant GM_registerMenuCommand
// ==/UserScript==
@sambacha
sambacha / find_optimizer_runs.sh
Last active April 23, 2024 16:52
Find Optimizer Runs for Solidity Compiler
#!/usr/bin/env bash
set -e
# Constants, run forge build --sizes first to see existing build size
# TODO Have a MAX_SIZE value for current build configuration?
TARGET_SIZE=6.250
MIN_RUNS=200
# Explanation of MAX_RUNS: Etherscan does not support verifying contracts with more than 10,000,000 optimizer runs.
# Using a higher number might not affect the bytecode output, but verification might require "spoofing" the optimizer run count.
@bdsqqq
bdsqqq / vesper-dark.json
Last active April 1, 2024 17:44
Vesper theme for zed.dev
{
"$schema": "https://zed.dev/schema/themes/v0.1.0.json",
"name": "Vesper",
"author": "Rauno Freiberg",
"themes": [
{
"name": "Vesper",
"appearance": "dark",
"style": {
"border": "#101010",
@rauchg
rauchg / p.sh
Last active April 27, 2024 10:43
Perplexity CLI in pure shell
#!/usr/bin/env bash
function p() {
jq -n \
--arg content "$*" \
'{
"model": "pplx-7b-online",
"messages": [
{
"role": "system",
"content": "Be precise and concise."

Multiple GitHub accounts (Work vs Personal)

This setup uses some tricks to ensure that the right email/name/ssh-key is used for the right repos without having to think about it ever again.

  • First generate two SSH keys, ~/.ssh/id_ed25519 and ~/.ssh/id_ed25519_work
  • Add one key to your personal account and the other to your work account

.ssh/config

@wesbos
wesbos / logger.js
Created January 8, 2024 15:55
console.log line numbers in Node.js
// Use like this: node --import logger.js yourapp.js
import path from 'path';
const { log } = console;
[`debug`, `log`, `warn`, `error`, `table`, `dir`].forEach((methodName) => {
const originalLoggingMethod = console[methodName];
console[methodName] = (...args) => {
const originalPrepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = (_, stack) => stack;
@kamilogorek
kamilogorek / _screenshot.md
Last active May 2, 2024 13:48
Clutter-free VS Code Setup
image
@guest271314
guest271314 / javascript_engines_and_runtimes.md
Last active May 3, 2024 17:07
A list of JavaScript engines, runtimes, interpreters

V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, among others. It implements ECMAScript and WebAssembly, and runs on Windows 7 or later, macOS 10.12+, and Linux systems that use x64, IA-32, ARM, or MIPS processors. V8 can run standalone, or can be embedded into any C++ application.

SpiderMonkey is Mozilla’s JavaScript and WebAssembly Engine, used in Firefox, Servo and various other projects. It is written in C++, Rust and JavaScript. You can embed it into C++ and Rust projects, and it can be run as a stand-alone shell. It can also be [compiled](https://bytecodealliance.org/articles/making-javascript-run-fast-on