Skip to content

Instantly share code, notes, and snippets.

@konradkonrad
konradkonrad / doof.sh
Last active February 28, 2018 09:26
[D]ocker [O]ne [OF]f script (run a container inside the current working directory)
#!/usr/bin/env sh
## Features:
## - host's working directory is mounted to random location as the container's working directory
## - uid/gid of the current user are preserved inside the container
## - a host tmp dir will be mounted as /home/user and published as HOME environment variable inside the container
## - all EXPOSED ports will be published (check `docker port $(docker ps -q|head -n1)`).
## - container will be removed on exit
##
## Examples:
@konradkonrad
konradkonrad / ips_in_networks.py
Created October 6, 2016 16:29
check list of ips against list of networks/netmasks
#!/usr/bin/env python
import sys
import ipaddress
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage:\n\t%s ips_file networks_file" % sys.argv[0])
sys.exit(0)
@konradkonrad
konradkonrad / pk_dump.py
Created February 22, 2017 15:04
decode private key from Web3-Secret-Storage
from ethereum.keys import decode_keystore_json
with open('/path/to/keystorefile.json') as f:
print decode_keystore_json(json.load(f), 'yoursecret').encode('hex')
@konradkonrad
konradkonrad / ecverify.sol
Last active March 14, 2017 12:15 — forked from axic/ecverify.sol
Ethereum ECVerify
//
// The new assembly support in Solidity makes writing helpers easy.
// Many have complained how complex it is to use `ecrecover`, especially in conjunction
// with the `eth_sign` RPC call. Here is a helper, which makes that a matter of a single call.
//
// Sample input parameters:
// (with v=0)
// "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad",
// "0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200",
// "0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a"
@konradkonrad
konradkonrad / expand_all_PR.js
Created September 20, 2017 10:32
expand all files in PR files view
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function expand_all() {
while (true) {
if ($$('tr.js-expandable-line a').map(function(x){x.click()}).length > 0) {
await sleep(200);
} else { break; }
}
}
var auction_abi = [{"constant":true,"inputs":[],"name":"num_tokens_auctioned","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"final_price","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price_exponent","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"end_time","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"bid","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"token_multiplier","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price_start","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutabi
@konradkonrad
konradkonrad / geth_pending_to_raw.py
Last active October 13, 2017 08:29
geth pending tx to raw tx hex
#!/usr/bin/env python
import sys
import yaml
from ethereum.transactions import Transaction
from ethereum.utils import encode_hex, decode_hex
import rlp
def geth_tx_to_raw(tx):
for field in ['blockHash', 'blockNumber', 'hash', 'transactionIndex', 'from']:
@konradkonrad
konradkonrad / docker-compose.yml
Last active October 27, 2017 09:18 — forked from ulope/docker-compose.yml
prometheus backfill test
version: "2.1"
services:
prom:
image: prom/prometheus
environment:
- TZ=$TZ
volumes:
- ./prom.yml:/etc/prometheus/prometheus.yml
ports:
@konradkonrad
konradkonrad / README.md
Last active December 30, 2017 13:18
ethereum blockies-py for terminal
@konradkonrad
konradkonrad / eth_events_grafana.json
Last active January 29, 2018 16:49
Get you started dashboard for grafana & eth.events
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",