Skip to content

Instantly share code, notes, and snippets.

View mirrorxyz-indexer.ts
import Arweave from "arweave";
type Post = {
authorship: {
contributor: string;
};
content: {
body: string;
timestamp: string;
title: string;
View ens-utils.js
// ens-utils.js
// import a couple data formatting libraries
const { default: BigNumber } = require('bignumber.js');
const uts46 = require('idna-uts46-hx');
// make sure to also impmort web3.js
const Web3 = require('web3');
// configure BigNumber to not round large floats
View eth-indexer.ts
import type { Log, Transaction, TransactionReceipt } from 'web3-core';
import type { BlockTransactionBase } from 'web3-eth';
import knex from 'knex';
import Web3 from 'web3';
let web3 = null;
let web3Websocket = null;
const db = knex({
client: 'pg',
View locustfile-py2.py
from locust import HttpLocust, TaskSet, between
from random import randint
MAX_TIMEOUT = 10
def cart_quote(l):
l.client.post('/app/api/cart/quote',
name='/cart/quote',
View locustfile.py
from locust import HttpLocust, TaskSet, between
from random import randint
MAX_TIMEOUT = 10
def cart_quote(l):
l.client.post('/api/v1/cart/quote',
name='/cart/quote',
View hasher.py
import hashlib
import json
def hasher(content, root=True):
if isinstance(content, list):
content = list([hasher(x, False) for x in content])
content.sort()
content = ''.join(content)
elif isinstance(content, dict):
View hosting_setup.sh
#!/bin/sh
# setup ssh
cd ~
mkdir -p ~/.ssh
chmod 600 ~/.ssh
curl https://github.com/brock-haugen.keys > ~/.ssh/authorized_keys
chmod 700 ~/.ssh/authorized_keys
# setup vim