Skip to content

Instantly share code, notes, and snippets.

View anthowen's full-sized avatar
🏠
Working from home

anthowen

🏠
Working from home
View GitHub Profile

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@anthowen
anthowen / autogen.sh
Created August 11, 2023 12:37 — forked from PaulRBerg/autogen.sh
Shell script to generate Docusaurus site from NatSpec comments, see the original code: https://github.com/sablier-labs/v2-docs/blob/main/scripts/autogen.sh
#!/usr/bin/env bash
# Pre-requisites:
# - foundry (https://getfoundry.sh/)
# - rsync (https://github.com/WayneD/rsync)
# - pnpm (https://pnpm.io)
# - sd (https://github.com/chmln/sd)
# Strict mode: https://gist.github.com/vncsna/64825d5609c146e80de8b1fd623011ca
set -euo pipefail
@anthowen
anthowen / parse_azuki_logs.go
Last active April 29, 2023 12:49
Parse Azuki NFT transfer logs in Golang
package main
import (
"context"
"fmt"
"math/big"
"sync"
"time"
"github.com/ethereum/go-ethereum"
@anthowen
anthowen / postgres.md
Created June 1, 2022 18:30 — forked from phortuin/postgres.md
Set up postgres + database on MacOS (M1)

Based on this blogpost.

Install with Homebrew:

$ brew install postgresql

Run server:

@anthowen
anthowen / MultiSig.sol
Created December 27, 2021 02:02 — forked from z0r0z/MultiSig.sol
EIP-712-signed multi-signature contract
// SPDX-License-Identifier: GPL-3.0-or-later
error NoExecParity();
error NoSigParity();
error NotSigner();
error SigOutOfOrder();
@anthowen
anthowen / FlashPotBorrow.sol
Created December 27, 2021 02:02 — forked from z0r0z/FlashPotBorrow.sol
test flash borrowing on flashpot - just send a fee's worth of ETH to this address then call flashBorrow (using 0 address for 'address')
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.4;
import "https://github.com/Rari-Capital/solmate/blob/audit-fixes/src/utils/SafeTransferLib.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/interfaces/IERC3156FlashLender.sol";
contract FlashPotBorrow is IERC3156FlashBorrower {
using SafeTransferLib for address;
/**
* 1. Initialize new node project (npm init -y)
* 2. Run: npm install ethers
* 3. Add private key where PRIVATE_KEY
* 4. Optionally, update gas price (line 29) or chosen gas limit
* 4. Run: node score-claim.js
*/
// Imports
const ethers = require("ethers");
const { parseUnits } = require("@ethersproject/units");
const { expect } = require("chai");
describe("NFTOptions", function () {
const penguAddr = "0xBd3531dA5CF5857e7CfAA92426877b022e612cf8";
const penguOwner = "0x2c2c2F6DBe08942280d4F7626b6BAd5C11D20215";
const ids = ["2036", "4205"];
const buyer = "0xe5ee2B9d5320f2D1492e16567F36b578372B3d9F";
const erc721Abi = [
"function approve(address to, uint256 tokenId)"
@anthowen
anthowen / FormikOnChange.js
Created July 2, 2021 01:21
The formik onChange solution. The one utility component you will be mostly looking for when using Formik
import { useRef } from 'react';
import PropTypes from 'prop-types';
import useDeepCompareEffect from 'use-deep-compare-effect';
import { useDebouncedCallback } from 'use-debounce';
import { useFormikContext } from 'formik';
const FormikOnChange = ({ delay, onChange }) => {
const { values } = useFormikContext();
const isFirstRun = useRef(true);
const debouncedOnChange = useDebouncedCallback(onChange, delay);
@anthowen
anthowen / readme.md
Created June 9, 2021 19:12
How to publish a private JavaScript library to GPR using yarn package manager

This instruction is to register the library to GPR privately under the certain organization, like @org/lib.

  1. package.json
{
  "name": "@org/lib",
  "repository": {
    "type": "git",
 "url": "https://github.com/org/lib.git"