Skip to content

Instantly share code, notes, and snippets.

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

Julien Bouteloup bneiluj

🏠
Working from home
View GitHub Profile
@bneiluj
bneiluj / promise_monad.md
Created January 4, 2018 21:45 — forked from VictorTaelin/promise_monad.md
async/await is just the do-notation of the Promise monad

async/await is just the do-notation of the Promise monad

CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.

In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.

First, let's illustrate the 3 styles by implementing

@bneiluj
bneiluj / InviteLink.sol
Created November 21, 2018 14:23 — forked from mikhaildobs/InviteLink.sol
InviteLink module for ERC-1077
@bneiluj
bneiluj / auto-delegate.sh
Last active December 4, 2018 22:19 — forked from nckrtl/auto-delegate.sh
Auto delegate
echo "Enter your key password:"
read -s password
while true
do
amount_steak=$(gaiacli query account <comosaddr> --chain-id=9002 --trust-node=true | jq -r '.value.coins[0].amount')
if [[ $amount_steak > 0 && $amount_steak != "null" ]]; then
echo "About to stake ${amount_steak} steak"
echo "${password}" | gaiacli tx delegate --amount=${amount_steak}steak --from=crytter --validator=<cosmosvaloper> --chain-id=gaia-9001
fi
echo "Enter your key password:"
read -s password
while true
do
amount_steak=$(gaiacli query account <comosaddr> --chain-id=9002 --trust-node=true | jq -r '.value.coins[0].amount')
if [[ $amount_steak > 0 && $amount_steak != "null" ]]; then
echo "About to stake ${amount_steak} steak"
echo "${password}" | gaiacli tx delegate --amount=${amount_steak}steak --from=crytter --validator=<cosmosvaloper> --chain-id=gaia-9002
fi
@bneiluj
bneiluj / gaia_install.sh
Last active December 5, 2018 13:01 — forked from kwunyeung/gaia_install.sh
bash script for installing go and gaia testnet on Ubuntu
#!/bin/bash
# Upgrade the system and install go
sudo apt update
sudo apt upgrade -y
sudo apt install gcc git make -y
sudo snap install --classic go
sudo mkdir -p /opt/go/bin
# Export environment variables
[
{
"user": "0xDA6B746B76fDC8424764d6981e9eF5C3b13A56af",
"transactionHash": "0x7d9e3f20d67637fcf7423bae7d1659707978b79f09c67978db0dcde2239040fa",
"amount": 14752.704765297914,
"blockNumber": 11694521,
"dexes": [
{
"uniswap": 14752.704765297914
}
@bneiluj
bneiluj / Fei_stable_rekt_holders.md
Last active April 7, 2021 12:35
Fei Stable Rekt Holders

"Txhash","Blockno","UnixTimestamp","DateTime","From","To","Quantity" "0xc9851f374701f76024c1f44f7166e0ef8a99456750463dc9d7b426e6359b9b20","12168368","1617476386","2021-04-03 18:59:46","0x0000000000000000000000000000000000000000","0xbffb152b9392e38cddc275d818a3db7fe364596b","1302613195.32604" "0xc9851f374701f76024c1f44f7166e0ef8a99456750463dc9d7b426e6359b9b20","12168368","1617476386","2021-04-03 18:59:46","0x0000000000000000000000000000000000000000","0x9b0c6299d08fe823f2c0598d97a1141507e4ad86","1315770904.36974" "0xc9851f374701f76024c1f44f7166e0ef8a99456750463dc9d7b426e6359b9b20","12168368","1617476386","2021-04-03 18:59:46","0x9b0c6299d08fe823f2c0598d97a1141507e4ad86","0x94b0a3d511b6ecdb17ebf877278ab030acb0a878","1315770904.36974" "0xc9851f374701f76024c1f44f7166e0ef8a99456750463dc9d7b426e6359b9b20","12168368","1617476386","2021-04-03 18:59:46","0x9b0c6299d08fe823f2c0598d97a1141507e4ad86","0x0000000000000000000000000000000000000000","0" "0xc9851f374701f76024c1f44f7166e0ef8a99456750463dc9d7b426e6359b9b20","1216