Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am banteg on github.
  • I am banteg (https://keybase.io/banteg) on keybase.
  • I have a public key whose fingerprint is D07D 93C0 D514 B6E5 EE6E F713 7B6E 8BE9 B131 9FD3

To claim this, I am signing this object:

@banteg
banteg / eos.py
Last active December 5, 2017 11:00
interact with eos token sale contract from python
from web3 import Web3, KeepAliveRPCProvider
web3 = Web3(KeepAliveRPCProvider(host='localhost', port='8545'))
address = '0xd0a6e6c54dbc68db5db3a091b171a77407ff7ccf'
abi = [{'constant': True, 'inputs': [{'name': '', 'type': 'uint256'}, {'name': '', 'type': 'address'}], 'name': 'claimed', 'outputs': [{'name': '', 'type': 'bool'}], 'payable': False, 'type': 'function'}, {'constant': False, 'inputs': [{'name': 'owner_', 'type': 'address'}], 'name': 'setOwner', 'outputs': [], 'payable': False, 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'time', 'outputs': [{'name': '', 'type': 'uint256'}], 'payable': False, 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'totalSupply', 'outputs': [{'name': '', 'type': 'uint128'}], 'payable': False, 'type': 'function'}, {'constant': True, 'inputs': [], 'name': 'foundersAllocation', 'outputs': [{'name': '', 'type': 'uint128'}], 'payable': False, 'type': 'function'}, {'constant': False, 'inputs': [{'name': 'day', 'type': 'uint256'}], 'name': 'claim', '
import ujson
import asyncpg
class DB:
def __init__(self):
self.pool = None
async def init(self, *args, **kwds):
Verifying my Blockstack ID is secured with the address 1PPDacCeRus3KdQXRSkzqPtAdnCAmLwHnK https://explorer.blockstack.org/address/1PPDacCeRus3KdQXRSkzqPtAdnCAmLwHnK
@banteg
banteg / parity-nov6.csv
Last active October 4, 2022 16:34
november 6 parity hack affected addresses and balances
address eth comment
0x3bfc20f0b9afcace800d73d2191166ff16540258 306276.272251399926202 polkadot
0x376c3e5547c68bc26240d8dcc6729fff665a4448 114939 iconomi
0x43ab622752d766d694c005acfb78b1fc60f35b69 21704.325572809991471999
0xc7cd9d874f93f2409f39a95987b3e3c738313925 16475.534165330527033716 musiconomi
0xdb0e7d784d6a7ca2cbda6ce26ac3b1bd348c06f8 6925
0x49eafa4c392819c009eccdc8d851b4e3c2dda7d0 4524.983603998439805528
0xbe17d91c518f1743aa0556425421d59de0372766 4360.6725
0x41849f3bd33ced4a21c73fddd4a595e22a3c2251 3238.1539315355843176
0x8655d6bf4abd2aa47a7a4ac19807b26b7609b61d 3000
from ecdsa import SigningKey, SECP256k1
from sha3 import keccak_256
priv = SigningKey.generate(curve=SECP256k1)
pub = priv.get_verifying_key().to_string()
address = keccak_256(pub).hexdigest()[24:]
print(f'private key: 0x{priv.to_string().hex()}')
print(f'public key: 0x{pub.hex()}')
print(f'address: 0x{address}')
@banteg
banteg / script.js
Created December 5, 2017 10:01
cryptokitty rare cards (script for tampermonkey)
// ==UserScript==
// @name Crypto Kitty Info Extension
// @namespace https://github.com/HaJaeKyung/CryptoCatAdd
// @version 0.18
// @description Adds stat info to the site
// @author HaJaeKyung
// @match *.cryptokitties.co/*
// @grant none
// @require http://code.jquery.com/jquery-3.2.1.min.js
// ==/UserScript==
@banteg
banteg / contracts.yml
Created December 5, 2017 20:22
import cryptokitties in elasticsearch
auction:
address: '0xb1690C08E213a35Ed9bAb7B318DE14420FB57d8C'
abi: [{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"},{"name":"_startingPrice","type":"uint256"},{"name":"_endingPrice","type":"uint256"},{"name":"_duration","type":"uint256"},{"name":"_seller","type":"address"}],"name":"createAuction","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"bid","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"lastGen0SalePrices","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"fu
import puresnmp
from prometheus_client.core import REGISTRY, GaugeMetricFamily
from prometheus_client import start_http_server
class AirPortExporter:
def collect(self):
in_bytes = puresnmp.get('10.0.1.1', 'public', '1.3.6.1.2.1.2.2.1.10.1')
out_bytes = puresnmp.get('10.0.1.1', 'public', '1.3.6.1.2.1.2.2.1.16.1')
from ecdsa import SigningKey, SECP256k1
from sha3 import keccak_256
import click
@click.command()
@click.argument('count', type=click.types.IntRange(1, 1000), default=1)
def main(count):
for i in range(count):
priv, addr = generate_pair()