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
@StuartFarmer
StuartFarmer / Overlaying MKMapView with OSM Data
Last active August 23, 2022 11:59
Quick snippet to overlay Apple map data with OSM data, MapBox data, or any other map that has an online tile system on the MKMapView
// Import these Frameworks:
#import <MapKit/MapKit.h>
// Include this delegate
@interface ViewController () <MKMapViewDelegate>
- (void)viewDidLoad
{
// Add this code to your preexisting viewDidLoad method
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 = '''
@StuartFarmer
StuartFarmer / classification-forex-model.py
Created October 24, 2016 02:27
Classification Forex Prediction Model
import csv
import random
import numpy as np
import matplotlib.pyplot as plt
import math
import os
os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=gpu,floatX=float32,allow_gc=False"
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
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