Skip to content

Instantly share code, notes, and snippets.

View daragao's full-sized avatar

Duarte Aragão daragao

View GitHub Profile
@daragao
daragao / Chainlink Price feeds.ipynb
Last active August 1, 2021 15:41
Study about Chainlink in and outflows
@daragao
daragao / singleFileAPI3.js
Created March 3, 2021 17:08
API3 Airnode contracts make a request and fulfill it
const hre = require("hardhat");
async function main() {
const signers = await hre.ethers.getSigners();
const owner = signers[0];
const Airnode = await hre.ethers.getContractFactory("Airnode", owner);
const Convenience = await hre.ethers.getContractFactory("Convenience", owner);
@daragao
daragao / printEvent.js
Created March 2, 2021 23:40
Simple Web3 script to print events
const Web3 = require('web3')
const BN = require('bn.js')
const Big = require('big.js')
// what is a wad https://makerdao.com/purple/#sec-3-1
const wadToEth = (value) => {
return (new Big(value)).div((new BN(10)).pow(new BN(18)))
}
const printEvent = (web3, eventType) => (event) => {
#!/bin/bash
UP_SYMBOL=▲
DOWN_SYMBOL=▼
# BTC_SYMBOL="<fc=#FFFF00>฿</fc>"
BTC_SYMBOL="<fc=#FF9900><fn=1></fn></fc>"
#ETH_SYMBOL="<fc=#7777FF>Ξ</fc>"
ETH_SYMBOL="<fc=#7777FF><fn=1></fn></fc>"
@daragao
daragao / refreshTouchbar.sh
Created January 15, 2021 12:53
Everytime the Esc disappears from the touchbar :)
#!/bin/bash
sudo pkill TouchBarServer; sudo killall ControlStrip
@daragao
daragao / nested_nodes_trie_example.go
Last active April 20, 2020 16:12
Example of a Patricia Trie with some value smaller than 32bytes wich results in nodes being nested inside each other
package main
import (
"fmt"
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethdb/memorydb"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
@daragao
daragao / slackspammer.sh
Last active January 29, 2020 13:49
Slack Spammer
#!/bin/bash
# need curl and jq installed
# go to https://api.slack.com/apps and create an app
# add OAuth permissions:
# calls:write
# channels:join
# channels:manage
# channels:read
@daragao
daragao / parse_timeline_history.py
Created November 11, 2019 00:13
Parses history location from https://takeout.google.com/ (useful to check where you have been in the last few years)
import json
from datetime import datetime
import reverse_geocoder as rg
location_history = None
json_filename = 'timeline_history/Location History/Location History.json'
print('Loading: %s' % json_filename)
with open(json_filename, 'r') as f:
location_history = json.load(f)
@daragao
daragao / generateEthereumKey.sh
Created August 9, 2019 11:02
script to generate Ethereum private key, public key, and address
#!/bin/bash
#Libs used for keccak-256sum
#https://github.com/maandree/libkeccak.git
#https://github.com/maandree/argparser.git
#https://github.com/maandree/sha3sum.git
# Generate the private and public keys
KEY="$(openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout 2> /dev/null)"
echo "$KEY"
@daragao
daragao / luckyGuessGenKey.sh
Created June 7, 2017 09:53
(Useless crazy :D ) Bash script that keeps generating keys and saves the key if that Ethereum account has ether
#!/bin/bash
COUNTER=0
trap '{ echo "Hey, you pressed Ctrl-C. Loop Counter: $COUNTER Time to quit." ; exit 1; }' INT
#./go-ethereum/build/bin/geth --bootnodes enode://f4642fa65af50cfdea8fa7414a5def7bb7991478b768e296f5e4a54e8b995de102e0ceae2e826f293c481b5325f89be6d207b003382e18a8ecba66fbaf6416c0@33.4.2.1:30303 --rpc
#Libs used for keccak-256sum
#https://github.com/maandree/libkeccak.git