Skip to content

Instantly share code, notes, and snippets.

docker run -d --name ipfs-node -p 8080:8080 -p 8081:8081 -p 4001:4001 -p ipfs/go-ipfs:v0.4.22
docker run -it -p 28000:27017 --name mongoContainer mongo:3.6.13 mongo "mongodb+srv://<HOST>/<DB>" --username <USERNAME>
stevenc81 /
Created January 6, 2020 20:20
Ethereum Private Key to Public Key and Address
from eth_keys import keys
from eth_utils import decode_hex
# Private key here
priv_key_bytes = decode_hex('0xfbef6fd0f61d054be68aa044d033d83b87ed1bbde658dfa0b4bfdb06e39f6af6')
priv_key = keys.PrivateKey(priv_key_bytes)
pub_key = priv_key.public_key
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<head lang="en">
<meta charset="utf-8" />
<title>BIP39 - Mnemonic Code</title>
* Bootstrap v3.3.7 (
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (
from web3 import Web3
import requests
CONTRACT_ADDRESS = '0x39aa39c021dfbae8fac545936693ac917d5e7563'
def main():
w3 = Web3(Web3.HTTPProvider('<YOUR PROJECT ID>'))
r = requests.get(f'{CONTRACT_ADDRESS}')
checksummed_address = w3.toChecksumAddress(CONTRACT_ADDRESS)
if (total_borrow / total_supply) > 0.65 or liquidity < 10000000000000:
r =
'<YOUR DOMAIN>/messages',
auth=('api', '<YOUR API KEY>'),
data={'from': 'DeFi Alerts <>',
'subject': "High utilization or low liquidity",
'text': f"Current rate {total_borrow / total_supply}\n" +
f"Current liquidity {liquidity / 1000000}"})

The Minimalist DeFi Liquidity Alert - An effective way to manage DeFi bank run risk

What the hell are you babbling about?

For those who have no idea what the title says, I offer my apology here. Finance by itself is a deep topic with many trade-offs, similar to the world of engineering. According to a greate economists Thomas Sowell

There are no solutions, only trade-offs

In the DeFi (Decentralized Finance) sense, as much as we all love the high interest rates, the trade-offs aren't always clear in this nascent industry. The underlying concept is really simple and sound. It goes something like this:

apiVersion: batch/v1beta1
kind: CronJob
namespace: dev
name: steven-cron
app: steven-cron
schedule: "* * * * *"
kind: InstanceGroup
name: frequent-cronjob-nodes
machineType: m4.xlarge
maxSize: 2

Tainting and Labeling Kubernetes Nodes to Run Special Workload - A quick guide that is finally NOT confusing

All right folks, I intend to keep this one short and that's what I will do. I mean, it's supposed to be easy but the official documentations(1, 2) make it unnecessary confusing. So I think maybe I can help filling in the gap.

I will be using one of our business requirements at Buffer in this project, as the example for this blog post.

Quick recap

So, we need a few nodes that are dedicated to running cronjobs, and nothing else. At the same time we want to make sure the cornjobs are scheduled to these nodes, and nowhere else. This means we need 2 things