Skip to content

Instantly share code, notes, and snippets.

View hexonaut's full-sized avatar

Sam MacPherson hexonaut

View GitHub Profile
@hexonaut
hexonaut / .eth
Last active October 6, 2023 09:56
Turbocharge your Ethereum dev environment with this script. Support for multi-chain environments. Tailored for Maker, but mostly generic to Ethereum + L2s.
# Setup variables
export PS1="\[\e[32m\]\W\[\e[91m\]\$(parse_git_branch)\[\e[00m\] $ "
export DEFAULT_PS1="$PS1"
# RPC Endpoints
export REMOTE_MAINNET_RPC_URL=https://eth-mainnet.alchemyapi.io/v2/XXX
export OFFICE_MAINNET_RPC_URL=http://geth.dappnode:8545
export MAINNET_RPC_URL="$REMOTE_MAINNET_RPC_URL"
export OPTIMISM_RPC_URL=https://opt-mainnet.g.alchemy.com/v2/XXX
gp() {
if [ $# -eq 0 ]
then
echo Gas price is $(echo $ETH_GAS_PRICE / 1000000000 | bc) Gwei
return
elif [ "$1" = "fast" ]
then
GAS_GWEI=$(curl -s "https://api.etherscan.io/api?module=gastracker&action=gasoracle&apikey=APIKEY" | jq -r .result.FastGasPrice)
elif [ "$1" = "trade" ]
then
@hexonaut
hexonaut / collateral_deploy.sh
Created December 3, 2020 13:43
Deploy Collateral
#!/bin/bash
####################################################
# Deploy all scripts on chain to prepare for spell
#
# Requires MCD environment variables to be in scope https://changelog.makerdao.com/releases/kovan/active/contracts.json
#
# Usage: ./collateral_deploy.sh <DSS GEM JOIN DIR> <GEM JOIN VARIANT> <ILK> <TOKEN ADDRESS>
# Example: ./collateral_deploy.sh ~/dev/makerdao/dss-gem-joins GemJoin5 ETH-A 0xe3dD56821f8C422849AF4816fE9B3c53c6a2F0Bd
####################################################
R (Rotation) = [ cosA -sinA, sinA cosA ], S (Scale) = [ Sx 0, 0 Sy ]
M = RS
M11 = Sx*cosA
M21 = Sx*sinA
=> tanA = M21 / M11
=> A = arctan(M21 / M11)
/**
* Renders a lighting mask which can be added to the display list via Bitmap.
* @author Sam MacPherson
*/
package as3gl.lighting;
import as3gl.core.Destroyable;
import as3gl.core.Runnable;
import as3gl.display.Batcher;
@hexonaut
hexonaut / Memory.hx
Created May 31, 2012 22:36
flash.Memory patch to remove alchemy dependancies
package flash;
#if !flash_no_alchemy extern #end class Memory {
#if flash_no_alchemy
private static var mem:flash.utils.ByteArray = prepareInitialByteArray();
private static function prepareInitialByteArray ():flash.utils.ByteArray {
var b = new flash.utils.ByteArray();
b.endian = flash.utils.Endian.LITTLE_ENDIAN;