This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"` | |
#include <SPI.h> | |
#include <ezTime.h> | |
#include <SPIFFS.h> | |
#include <ESPAsyncWebServer.h> | |
#include <WiFi.h> | |
AsyncWebServer server(80); | |
SSD1306 display(0x3c, 4, 15); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import math | |
import matplotlib.pyplot as plt | |
def getResults(num_groups=4, num_players=9): | |
players = ['Player {i}'.format(i=i) for i in range(1, num_players)] | |
players += ['You', 'Casino'] | |
random.shuffle(players) | |
group_size = math.ceil(len(players) / num_groups) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{'type': 'trade', 'symbol': 'SPY180606P00235000', 'exch': 'I', 'price': '0.08', 'size': '2', 'cvol': '0', 'date': '1527611813000', 'last': '0.08'} | |
{'type': 'trade', 'symbol': 'SPY180606C00261000', 'exch': 'C', 'price': '14.29', 'size': '30', 'cvol': '50', 'date': '1528209279000', 'last': '14.29'} | |
{'type': 'trade', 'symbol': 'SPY180606C00235000', 'exch': '', 'price': '', 'size': '0', 'cvol': '0', 'date': '0', 'last': ''} | |
{'type': 'trade', 'symbol': 'SPY180606P00256000', 'exch': 'Q', 'price': '0.01', 'size': '3', 'cvol': '0', 'date': '1528119065000', 'last': '0.01'} | |
{'type': 'quote', 'symbol': 'SPY', 'bid': 275.34, 'bidsz': 1, 'bidexch': 'P', 'biddate': '1528238802000', 'ask': 275.37, 'asksz': 22, 'askexch': 'P', 'askdate': '1528238662000'} | |
{'type': 'trade', 'symbol': 'SPY', 'exch': 'P', 'price': '275.1', 'size': '0', 'cvol': '51115122', 'date': '1528237800000', 'last': '275.1'} | |
{'type': 'quote', 'symbol': 'SPY', 'bid': 275.34, 'bidsz': 1, 'bidexch': 'P', 'biddate': '1528238802000', 'ask': 275.37, 'asksz': 22, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Exception in thread Thread-1: | |
Traceback (most recent call last): | |
File "/home/nak/.virtualenvs/tradier-bot/lib/python3.6/site-packages/urllib3/response.py", line 543, in _update_chunk_length | |
self.chunk_left = int(line, 16) | |
ValueError: invalid literal for int() with base 16: b'' | |
During handling of the above exception, another exception occurred: | |
Traceback (most recent call last): | |
File "/home/nak/.virtualenvs/tradier-bot/lib/python3.6/site-packages/urllib3/response.py", line 302, in _error_catcher |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def encode_pair(f): | |
# Decorator function to encode "pair" to bytes object | |
def new_f(*args, **kwargs): | |
args = list(args) | |
pair = args[1] | |
if type(pair) == str: | |
args[1] = pair.encode() | |
assert type(args[1]) == bytes | |
args = tuple(args) | |
return f(*args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zmq | |
from threading import Thread | |
from time import sleep | |
from random import randint | |
# Setup sockets for the proxy XSUB/XPUB and bind them to separate ports | |
ctx = zmq.Context() | |
xsub_sock = ctx.socket(zmq.XSUB) | |
xpub_sock = ctx.socket(zmq.XPUB) | |
xsub_sock.bind('tcp://127.0.0.1:1234') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zmq | |
from multiprocessing import Process | |
from time import sleep | |
""" | |
Simple multiprocess pub/sub ZeroMQ example python3 | |
2/15/2018 | |
""" | |
tcp_interface = 'tcp://127.0.0.1:5600' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gpu = new GPU(); | |
gpu.addFunction(function CND(x) { | |
var k = 1 / (1 + .2316419 * x); | |
if(x < 0) { | |
x = x * -1 | |
return 1 - ( 1 - Math.exp(-x * x / 2)/ Math.sqrt(2*Math.PI) * k * (.31938153 + k * (-.356563782 + k * (1.781477937 + k * (-1.821255978 + k * 1.330274429)))) ); | |
} else { | |
return ( 1 - Math.exp(-x * x / 2)/ Math.sqrt(2*Math.PI) * k * (.31938153 + k * (-.356563782 + k * (1.781477937 + k * (-1.821255978 + k * 1.330274429)))) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that "mindsforge.id" is my Blockstack ID. https://onename.com/mindsforge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from collections import defaultdict | |
from redis import StrictRedis | |
from activetick_http import ActiveTick | |
from datetime import datetime, timedelta | |
from bokeh.charts import Histogram, show | |
from bokeh.layouts import column, row | |
from bokeh.models import Range1d | |
from bokeh.models.widgets import Div |
NewerOlder