Skip to content

Instantly share code, notes, and snippets.

@sbauch
sbauch / alphabet.txt
Created November 28, 2023 04:58
ghost-writer
A,111111010011111
B,111111010101110
C,111111000110001
D,111111000101110
E,111111010110101
F,111111010010000
G,011101010110010
H,111110010011111
I,100011111110001
J,100111111110000
@sbauch
sbauch / useDelegatedAccount.ts
Created January 18, 2023 16:20
Example hook for using delegate cash with wagmi hooks.
import { useAccount, useContractRead } from 'wagmi';
import { abi, address as delegateCashAddress } from '~abis/delegateCash';
import { env } from '~env/client.mjs';
export function useDelegatedAccount() {
const { address, isConnected, ...account } = useAccount();
const txConfig = {
address: delegateCashAddress,
@sbauch
sbauch / ens-formula.js
Last active September 27, 2022 00:59
ENS names in Google Sheets
// Easily resolve addresses in a Google sheet to ENS names via @frolic's ENS resolution API - https://ensideas.com/about
// 1. In a Google sheet, select the menu item Extensions > Apps Script.
// 2. Replace the example code in the editor with the below function:
function LOOKUP_ENS(input) {
var endpoint = "https://api.ensideas.com/ens/resolve/" + input;
var response = UrlFetchApp.fetch(endpoint);
@sbauch
sbauch / NFTFinder.tsx
Created February 23, 2022 16:58
React input component for getting an NFT's contract address and token ID from popular marketplace URL strings
// Please stop using the OpenSea API to load all of my NFTs.
// It's getting terribly unwieldy the more NFTs I own, and
// I don't want to sift through a needle in a haystack to
// find the NFT I want to select for display etc. You're
// also contributing to the idea that NFTs are centralized,
// plus putting unnecessary load on OS servers.
// Most users though aren't technical enough to understand
// contract addresses and token IDs. So instead of asking
// for those directly, use an input like this where a user
import classnames from 'classnames';
import { Web3Context } from 'contexts/web3Context';
import CSS from 'csstype';
import React, { ReactElement, useContext } from 'react';
import styles from './styles.module.css';
const chainArgs = {
'137': {
chainId: '0x89',
@sbauch
sbauch / pickWinner.ts
Created September 2, 2021 14:56
Script for picking Wrassler giveaway winner
import 'dotenv/config';
import {ethers} from 'hardhat';
import RandomOrg from 'random-org';
import {
abi as arenaAbi,
address as arenaAddress,
} from '../deployments/matic/WrasslingArenaV2.json';
import {
@sbauch
sbauch / filters.xml
Last active September 1, 2021 15:36
Apply a filter to OpenSea emails to skip inbox
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>
<title>Mail Filters</title>
<id>tag:mail.google.com,2008:filters:z0000001630333632397*6447181831119360404</id>
<updated>2021-08-30T23:44:15Z</updated>
<author>
<name>Sam Bauch</name>
<email>sam@0xessential.com</email>
</author>
<entry>
@sbauch
sbauch / pinAssets.ts
Created August 7, 2021 00:59
NFT.storage loop
import * as fs from 'fs';
import * as path from 'path';
import 'dotenv/config';
import { NFTStorage, File } from "nft.storage";
async function main() {
const storage = new NFTStorage({ token: process.env.NFT_STORAGE_KEY });
const directory = [];
{
"timings": [
{
"Flash": 2,
"round": 0,
"time": 0,
"Playing": false,
"Watching": false,
"Countdown": 4
},
@sbauch
sbauch / get_audience.rb
Created January 12, 2015 17:20
Twitter List => Custom Audience
require 'twitter'
require 'csv'
handle = ARGV[0]
list = ARGV[1]
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR KEY"
config.consumer_secret = "YOUR SECRET"