Skip to content

Instantly share code, notes, and snippets.

View StuartFarmer's full-sized avatar
🏹
take the shot

Stuart Farmer StuartFarmer

🏹
take the shot
  • Lisbon, Portugal
View GitHub Profile
import numpy as np
import random
'''
How to use: Subclass Agent and override 'get_action_for_state' with a neural network or another piece of logic.
To make learning agents, store some weights as state and update them based on the reward that is returned.
Enviroment expects a 1D array, but you can modify this easily.
Environment logic has been reimplemented from this: https://drive.google.com/drive/folders/1qCvIeui5dJKMXnjUm9_wiPf65VVHdWwz
@StuartFarmer
StuartFarmer / pow_hash.py
Last active June 27, 2019 03:20
dynamic_pow_hash.py
import hashlib
import secrets
def SHA3_512_1ST_HALF(data):
h = hashlib.sha3_512()
h.update(data)
return h.digest()[:32]
def SHA3_512_2ND_HALF(data):
h = hashlib.sha3_512()
@StuartFarmer
StuartFarmer / push_tx.py
Created June 7, 2019 23:12
Push Lamden TX
from cilantro_ee.messages.transaction.publish import *
from cilantro_ee.messages.transaction.container import TransactionContainer
from cilantro_ee.messages.transaction.contract import ContractTransaction
from cilantro_ee.protocol import wallet
import requests
import secrets
SK = ''
SK = bytes.fromhex(SK)
import timeit
setup = '''
class c:
def __enter__(self):
pass
def __exit__(self, type, value, traceback):
pass
'''
@StuartFarmer
StuartFarmer / timeit-test.py
Created May 30, 2019 18:08
Timeit Try Except Finally
import timeit
te = '''
try:
pass
except:
pass
'''
tf = '''
import urllib2
"""
#Usage:
in a python shell
>> import get_pepperstone_data
>> get_pepperstone_data.run()
# Notes:
1: Selection of pairs is highly opinionated
@StuartFarmer
StuartFarmer / getdocstrings.py
Created May 10, 2018 19:25 — forked from SpotlightKid/getdocstrings.py
Parse Python source code and get or print docstrings.
# -*- coding: utf-8 -*-
"""Parse Python source code and get or print docstrings."""
__all__ = ('get_docstrings', 'print_docstrings')
import ast
from itertools import groupby
from os.path import basename, splitext
['EOS', 'https://etherscan.io/token/EOS']
['TRON', 'https://etherscan.io/token/0xf230b790e05390fc8295f4d3f60332c93bed42e2']
['VeChain', 'https://etherscan.io/token/0xd850942ef8811f2a866692a623011bde52a462c1']
['ICON', 'https://etherscan.io/token/0xb5a5f22694352c15b00323844ad545abb2b11028']
['OmiseGO', 'https://etherscan.io/token/OmiseGo']
['Populous', 'https://etherscan.io/token/0xd4fa1460f537bb9085d22c7bccb5dd450ef28e3a']
['Binance Coin', 'https://etherscan.io/token/0xB8c77482e45F1F44dE1745F52C74426C631bDD52']
['Status', 'https://etherscan.io/token/StatusNetwork']
['Aeternity', 'https://etherscan.io/token/0x5ca9a71b1d01849c0a95490cc00559717fcf0d1d']
['Maker', 'https://etherscan.io/token/Maker']
https://www.github.com/216k155/lux/blob/master/src/chainparams.cpp
https://www.github.com/42-coin/42/blob/master/src/net.cpp
https://www.github.com/aces-coin/acescoin/blob/master/src/net.cpp
https://www.github.com/acoin-project/acoin/blob/master/src/chainparams.cpp
https://www.github.com/adcoin-project/adcoin/blob/master/src/chainparams.cpp
https://www.github.com/adzcoin/adzcoin/blob/master/src/net.cpp
https://www.github.com/altcoinsbeta/shacoin-dead/blob/master/src/net.cpp
https://www.github.com/altcommunitycoin/altcommunitycoin-skunk/blob/master/src/chainparams.cpp
https://www.github.com/antho281/mineum/blob/master/src/net.cpp
https://www.github.com/antibitcoin/antibitcoin-source/blob/master/src/net.cpp
@StuartFarmer
StuartFarmer / lamdensale.sol
Last active October 24, 2017 19:23
LamdenSale
pragma solidity ^0.4.15;
/***
* PREDEPLOYMENT GUIDE:
* 1. Modify the tokenAddress in Presale contract.
* 2. Modify the team and seed addresses and shares.
* 3. Modify the tokenAddress in Sale contract.
/***
* DEPLOYMENT GUIDE: