Skip to content

Instantly share code, notes, and snippets.

View d10r's full-sized avatar

Didi d10r

View GitHub Profile
ssh [email protected] "journalctl --user -n ${NR_LINES:-50} -f -u $1"
#!/bin/bash
# This is a simple tool for deploying simple applications (mainly nodejs based ones) to the SF sandbox.
# If run without any env vars set, it will do this on the server:
# - clone the git repository specified in package.json
# - (if a local file .env.prod exists) create a file .env on the server with the same content
# - run "npm ci && npm run build"
# - create a systemd service for the application and start it (command: "npm run start")
# - (if a local file cron.json exists) setup cron jobs accordingly
#
#!/bin/bash
set -eu
set +x
# Usage: ./deploy_with_proxy.sh <contract_name> <constructor_types> <arg1> <arg2> ...
# Example: ./deploy_with_proxy.sh MyContract "uint256,address" 42 0x1234567890123456789012345678901234567890
# Requires: RPC and PRIVKEY env vars set, build artifacts in directory out/
# Uses the deterministic deployment proxy contract at 0x4e59b44847b379578588920cA78FbF26c0B4956C
# see https://github.com/Arachnid/deterministic-deployment-proxy for more details
#!/bin/bash
# usage: airtable-to-json.sh <airtable-url-from-browser> > my-data.json
AIRTABLE_URL=$1
API_KEY=${AIRTABLE_API_KEY}
# Check if API_KEY is set
if [ -z "$API_KEY" ]; then
echo "Error: AIRTABLE_API_KEY environment variable is not set"
#!/usr/bin/env node
/*
* usage: RPC=... NR_ADDRS=10 node get-first-addrs.js
*
* This script collects the first N unique addresses transacting on a chain, and saves them to a file.
*
* Environment Variables:
* - (required) RPC: The RPC URL to connect to
* - (optional) NR_ADDRS: The number of unique addresses to collect (default: 10)
@d10r
d10r / ERC20x.md
Last active February 14, 2025 18:22
ERC20x draft proposal

About

This is a modular proposal for the ERC20x EVM token Standard which extends ERC20.

Modules:

  • Primitives:
    • transfer to 1 (covered by ERC20. We add a variant which is allowed to invoke hooks)
    • flow to 1
    • transfer to n
    • flow to n
#!/bin/bash
# Script for deploying nodejs applications to the SF cloud ™.
# Requirements:
# - ssh access
# - application name in package.json or provided as env var APP_NAME
# - git url in package.json or provided as env var GIT_URL
# - package-lock.json
# - npm scripts "build" and "start"
# Optional:
@d10r
d10r / SUP.sol
Created January 8, 2025 16:40
Superfluid Token
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;
/* Openzeppelin Contracts */
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { ERC20Permit, Nonces } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
import { ERC20Votes } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
/**
* @title Superfluid Token Contract
#!/bin/bash
# Queries the native coin amount deposited for a given account with a paymaster.
# Requires cast and python installed
set -eu
#set -x
# Check if exactly two arguments are provided
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <network> <account_address> <threshold_in_ether>"
set -eux
# prerequisites: "forge" installed and in PATH, see https://book.getfoundry.sh/getting-started/installation
name=$1
mkdir $name
cd $name
forge init --no-commit