Skip to content

Instantly share code, notes, and snippets.


Erin Swenson-Healey laser

View GitHub Profile
#!/usr/bin/env bash
set -x
public_ip=$(curl -m 5 || echo "")
daemon_multiaddr=$(lotus net listen | grep 127 | sed -En "s/127\.0\.0\.1/${public_ip}/p")
miner_multiaddr=$(lotus-storage-miner net listen | grep 127 | sed -En "s/127\.0\.0\.1/${public_ip}/p")
miner_id=$(lotus-storage-miner info | grep Miner | cut -d ' ' -f2)
cd $(mktemp -d)
laser /
Last active Jun 26, 2020
Run Filecoin storage and retrieval flows on a local development network
#!/usr/bin/env bash
# Option 1: Build and run tests using specific lotus Git SHA:
# > ./ --lotus-git-sha=15b3e57634458af983082dcbb736140bba2abfdb
# Option 2: Build and run using binaries you've built previously (much faster)
laser /
Created Mar 31, 2020
start daemon with custom genesis block
#!/usr/bin/env bash
BASEDIR=$(mktemp -d -t "lotus-interopnet.XXXX")
git clone --branch "testnet/3" "${BASEDIR}/build"
mkdir -p "${BASEDIR}/scripts"
mkdir -p "${BASEDIR}/bin"


Can we (today) vary these values at runtime?

  • window_size_mib (const here)
  • sector_size_gib (const here)
  • !*wrapping_variant (?)
  • drg_parents (const here)
  • expander_parents (const here)
  • graph_name (? - ignore)
laser /
Last active May 29, 2019
integrate rust-fil-proofs and go-filecoin
#!/usr/bin/env bash
integration_branch=laser/test-integrations-$(date +%s)
laser /
Last active Jul 26, 2018
Erlang/OTP Review - First Meeting


General rules for making a distributed book club like this not-awful:

  • keep your mic muted unless you're speaking
  • raise your hand if you have something to say and wait for someone to call on you
  • if you're raising your hand and nobody calls on you, type a message into the chat

Chapter 1

laser /
Created Jul 18, 2018
pattern matching Java
public abstract class Tree {
// Constructor private so the type is sealed.
private Tree() {}
public abstract <T> T match(Function<Empty, T> a,
Function<Leaf, T> b,
Function<Node, T> c);
public static final class Empty extends Tree {
public <T> T match(Function<Empty, T> a,
laser /
Created Jul 14, 2018
fork/join shell
echo ""
echo "$(date "+%T") 'fork' a process..."
# opens the file as input fd 666 before the background job (curl) is started
exec 666< <(curl -s '')
echo ""
echo "$(date "+%T") 'fork' second process..."
# opens the file as input fd 666 before the background job (curl) is started
exec 777< <(curl -s '')
laser /
Last active Jun 12, 2018
How to Run All Tests in a Single Go File
go test ./... \
-v \
-run "$(cat commands/foo_test.go \
| grep -oE "^func Test[^(]*" \
| sed -e "s/func //" \
| tr "\n" "|" \
| sed -e "s/|$//")"
laser / postalcodes.js
Last active Jun 10, 2018
postal code regular expressions
View postalcodes.js
var codes = {
"AD": "AD\\d{3}",
"AM": "(37)?\\d{4}",
"AR": "([A-HJ-NP-Z])?\\d{4}([A-Z]{3})?",
"AS": "96799",
"AT": "\\d{4}",
"AU": "\\d{4}",
"AX": "22\\d{3}",
"AZ": "\\d{4}",
"BA": "\\d{5}",
You can’t perform that action at this time.