Skip to content

Instantly share code, notes, and snippets.

View ryanberckmans's full-sized avatar

Ryan Berckmans ryanberckmans

View GitHub Profile
@ryanberckmans
ryanberckmans / doubleLinkedList.scala
Created September 28, 2022 03:12
A doubly-linked list in Scala
import scala.annotation.tailrec
import com.thoughtworks.enableIf
// Doubly-linked lists allow O(1) removals at the cost of having a
// reference to the doubly-linked node itself. Some game objects store
// their own next/prev links, which allows for a convenient reference to
// the doubly-linked node (i.e. it's just the value stored) however then
// each value can partake in at most one list at a time (per next/prev,
// can have multiple types of next/prev as is done with Affect).
@ryanberckmans
ryanberckmans / cs-intern-coop-student-advice
Created November 13, 2021 19:17
advice for software undergrads with co-ops/internships that want to make it big in industry
In terms of getting a good co-op job or highly paid internship, here is what I recommend
1. change co-op employers every co-op term. Do not go back to the same employer. The first reason is you learn most in your first term, the second term is better for them and not for you. The second reason is that job-hunting and interviewing is 100% a crucial and learnable skill, and you need to practice it each co-op term instead of taking the easy way out and returning to the same employer.
2. every co-op term, always try as hard as you can to get a job at a top-tier employer. Like Google, Apple, Amazon, Netflix, Microsoft, or Facebook/Meta. Top-tier employers act as a very big signal on your resume for future employers. More importantly, top-tier employers have extremely good internal tooling and training programs, so they will help you become a great engineer. The way to get a job at a top-tier employer is quite simple but hard. First, you need an interview... get an interview by distinguishing yourself on paper. T
@ryanberckmans
ryanberckmans / miner-yesterday-mev-revenue.sh
Created June 6, 2021 16:57
Yesterday's total miner revenue from flashbots mev
# Here's a bash 1-liner to calculate how much flashbots MEV revenue was earned by miners yesterday.
# It uses the flashbots API, coingecko API, and requires curl, awk, jq, and ruby.
# Data is only available for the last 24 hours or most recent 10,000 blocks, per flashbots API limits.
# See blocks.flashbots.net.
#
# Example output:
#
# Yesterday's total miner MEV revenue
# -----------------------------------
# 486.25 ETH
@ryanberckmans
ryanberckmans / ethereum-ecommerce-week-in-ethereum-news.md
Created January 10, 2021 23:59
Selling jobs ads for Week in Ethereum News with ecommerce on ethereum

Selling jobs ads for Week in Ethereum News with ecommerce on ethereum

Motivation

Week in Ethereum News features crypto job ads and allows readers to buy these ads. Buying a job ad is a manual process that requires correspondence between the customer and Evan. Below, we show an ethereum-based ecommerce solution for an Amazon-like UX and hopefully less work processing these orders for Evan.

Proposed new UX when buying a job ad

Week in Ethereum News gains a new "Place a Job Ad" link to https://place-job-listing.evan.ethereum.eth.link/

@ryanberckmans
ryanberckmans / COVID19Deaths.scala
Created April 4, 2020 18:50
Monte Carlo simulation to estimate American deaths from COVID-19
// Monte Carlo simulation to estimate American deaths from COVID-19.
// The probability distribution of estimated deaths is taken from the
// Good Judgment Superforecaster project.
// "How many deaths attributed to COVID-19 in the U.S. will be reported/estimated as of 31 March 2021?"
// https://goodjudgment.io/covid/dashboard/
type Deaths = Int
def simulateEstimatedDeaths: Deaths = {
import scala.util.Random
// Augur's oracle can be used to bring information on-chain,
// allowing money to move automatically based on real-world facts.
// Augur's oracle is secure so long as money that depends on Augur
// is properly tracked in the Augur system.
// Money that depends on Augur's oracle, but isn't tracked in Augur,
// is said to be "parasitic" and is at risk of attack and a threat
// to Augur itself.
@ryanberckmans
ryanberckmans / k8s-ethereum-lightserve.yaml
Created December 16, 2017 22:44
Kubernetes deployment for Ethereum lightserve node
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: geth
labels:
app: geth
spec:
replicas: 1
selector:
matchLabels:
@ryanberckmans
ryanberckmans / gist:79946de421bd1940804a
Last active August 29, 2015 14:26
Ethereum geth mining crash: panic: ethash_full_new IO or memory error
Issue https://github.com/ethereum/go-ethereum/issues/1572
I0801 18:50:56.966438 6114 database.go:74] Alloted 16MB cache to /home/ryan/.ethereum/blockchain
I0801 18:50:56.973862 6114 database.go:74] Alloted 16MB cache to /home/ryan/.ethereum/state
I0801 18:50:56.980452 6114 database.go:74] Alloted 16MB cache to /home/ryan/.ethereum/extra
I0801 18:50:56.985460 6114 backend.go:290] Protocol Versions: [61 60], Network Id: 1
I0801 18:50:56.985755 6114 backend.go:319] Blockchain DB Version: 3
I0801 18:50:56.986026 6114 chain_manager.go:232] Last block (#18839) 52744422a10887088eab7d73ab09c54620e40cb930bf85f83bb9f5de858d874e TD=9454137162789868
I0801 18:50:57.015981 6114 cmd.go:122] Starting Geth/v1.0.0/linux/go1.4.2
I0801 18:50:57.016245 6114 server.go:311] Starting Server
@ryanberckmans
ryanberckmans / .grails-config
Last active August 29, 2015 14:13
"grails test-app" notification with bash and OSX
# OSX+bash notifications for "grails test-app"
# ---
# Pops up an OSX notification with "PASS/FAIL" whenever a "grails test-app" command finishes.
# Limitations
# ---
# Only shows notification if "grails test-app" created a new /target/test-reports/html/all.html
# Uses bash history, so it might not work if you have a shell alias for "grails test-app"
# Only works for one grails repository at a time.
# If you have two repositories simultaneously running "grails test-app", it won't work.