Skip to content

Instantly share code, notes, and snippets.

8489ff653d42 public.ecr.aws/supabase/postgres:17.4.1.048 "sh -c '\ncat <<'EOF'…" 2 weeks ago Up 2 days (healthy) 0.0.0.0:54322->5432/tcp, [::]:54322->5432/tcp supabase_db_indexer
41af0a3f2045 public.ecr.aws/supabase/studio:2025.06.16-sha-c4316c3 "docker-entrypoint.s…" 4 weeks ago Up 2 days (healthy) 0.0.0.0:54323->3000/tcp, [::]:54323->3000/tcp supabase_studio_indexer
42f6affc4d43 public.ecr.aws/supabase/postgres-meta:v0.89.3 "docker-entrypoint.s…" 4 weeks ago Up 2 days (healthy) 8080/tcp supabase_pg_meta_indexer
bc52f0f64da7 public.ecr.aws/supabase/storage-api:v1.24.6 "docker-entrypoint.s…" 4 weeks ago Up 2 days (healthy) 5000/tcp supabase_storage_indexer
e7a42311e91a public.ecr.aws/supabase/postgrest:v12.2.12
import {
createPublicClient,
createWalletClient,
http,
parseEther,
formatEther,
isAddress,
type Address,
type Hash,
type TransactionReceipt,
export function createQueue(options?: Partial<{ maxItems?: number, noRun?: boolean }>) {
const queue: QueueAction[] = []
let isPendingAction = false
const maxItems = options?.maxItems
return {
async enqueue(action: QueueAction) {
if (maxItems && queue.length === maxItems) {
queue.shift() // throw away
}
@agazso
agazso / index.html
Last active December 11, 2020 13:49
Swarm File Upload
<!-- https://gist.github.com/agazso/15b2245cfa1206ec34f60c782b96b2cf -->
<html>
<head>
<title>Swarm File Uploader</title>
<script src="/files/192a6e12ffc8bd9a246103bcac2a6c7afac55bc9dd1eaf2cb37c0b6cad9be278"></script>
<script>
const url = window.location.origin
const bee = new window['@ethersphere/bee-js'].default(url)
function getIndexDocument(files) {
@agazso
agazso / dates.ts
Created November 20, 2020 15:32
Performance logging in Typescript
const dates = []
const logDates = () => dates.forEach((datePair, index) => {
if (index === 0) {
console.debug(datePair[0], datePair[1])
} else {
console.debug(datePair[0], datePair[1], 'elapsed: ' + (datePair[1] - dates[index - 1][1]))
}
if (index === dates.length - 1) {
console.debug('total', 'elapsed: ' + (datePair[1] - dates[0][1]))
}
@agazso
agazso / error.ts
Last active November 20, 2020 16:20
Type safe error handling in Typescript with classes
// compile: tsc error.ts --lib ES2015,dom
type Result<T> = T | Error
const isError = <T>(r: Result<T>): r is Error => (r instanceof Error)
class CustomError extends Error {
value: any
constructor(value, ...params) {
super(...params)
const axios = require('axios')
const apiKey = 'YOUR-ETHERSCAN-API-KEY'
const address = '0xb27e3af4eb6e40007b5f74a635b9d5fb6c4887ec'
const urlBase = 'https://api-goerli.etherscan.io/api'
async function txlist(address) {
const url = `${urlBase}?module=account&action=txlist&address=${address}&startblock=0&endblock=99999999&sort=asc&apikey=${apiKey}`
const response = await axios.get(url)
return response.data.result
@agazso
agazso / FelfeleSocialProtocol.md
Created December 17, 2019 19:12
Felfele Social Protocol Draft

Felfele Social Protocol

In this article we will describe a social protocol on the Ethereum Swarm decentralized cloud service. Our goal is to make the protocol comprehensive and practical so that it covers all the basic functionality, although due to the richness of social applications it does not thrive to be complete. This is not (yet) a specification of a standard, but rather a result of research that hopefully inspires others to share similar ideas, enable cooperation and compatibility.

Our goals include:

  • good usability
  • pretty good privacy
  • anonymity
  • self-sovereignity
  • sustainability
@agazso
agazso / gist:2db41e42f8dbe24108000f7eb200f4b5
Created November 27, 2019 18:45
erebos yarn start error output
% yarn start
yarn run v1.19.2
$ yarn build && yarn test:all
$ lerna run build
lerna notice cli v3.19.0
lerna info Executing command in 33 packages: "yarn run build"
lerna info run Ran npm script 'build' in '@erebos/secp256k1' in 45.2s:
$ yarn test:types && yarn clean && yarn build:js && yarn build:types
$ tsc --noEmit -p tsconfig.build.json
$ del cjs esm types
09-27 18:20:49.546 6730 6790 I GoLog : DEBUG[09-27|16:20:49.545] handleRequestSubscription: streamer 3c45a70dc5d73bff72133821d8060d47dcdf83f483b7d177a96301bcc10ee948 to subscribe to 815813dc8520dd3739f703df2817464f8e4897b28884d1d34edcfd160f31ead0 with stream SYNC|4|l
09-27 18:20:49.567 6730 6780 I GoLog : DEBUG[09-27|16:20:49.546] handleRequestSubscription: streamer 3c45a70dc5d73bff72133821d8060d47dcdf83f483b7d177a96301bcc10ee948 to subscribe to 815813dc8520dd3739f703df2817464f8e4897b28884d1d34edcfd160f31ead0 with stream SYNC|4|l
09-27 18:20:49.567 6730 6780 I GoLog : DEBUG[09-27|16:20:49.550] handleRequestSubscription: streamer 3c45a70dc5d73bff72133821d8060d47dcdf83f483b7d177a96301bcc10ee948 to subscribe to 0ac419439f72566d1be65c336e7ecfdfd5fbbb0ffd2aaaaf3bc9a58b6823e5cf with stream SYNC|6|l
09-27 18:20:49.570 6730 6780 I GoLog : DEBUG[09-27|16:20:49.568] handleRequestSubscription: streamer 3c45a70dc5d73bff72133821d8060d47dcdf83f483b7d177a96301bcc10ee948 to subscribe to 815813dc8520dd3739f