Skip to content

Instantly share code, notes, and snippets.

@jsomers
jsomers / websockets.md
Created September 27, 2018 12:50
Using websockets to easily build GUIs for Python programs

Using websockets to easily build GUIs for Python programs

I recently built a small agent-based model using Python and wanted to visualize the model in action. But as much as Python is an ideal tool for scientific computation (numpy, scipy, matplotlib), it's not as good for dynamic visualization (pygame?).

You know what's a very mature and flexible tool for drawing graphics? The DOM! For simple graphics you can use HTML and CSS; for more complicated stuff you can use Canvas, SVG, or WebGL. There are countless frameworks, libraries, and tutorials to help you draw exactly what you need. In my case, this was the animation I wanted:

high-priority

(Each row represents a "worker" in my model, and each rectangle represents a "task.")

@Valian
Valian / arbitrage.py
Created January 18, 2018 23:33
Short script for finding Binance Triangle arbitrage opportunities - requires python-binance installed
from collections import defaultdict
from operator import itemgetter
from time import time
from binance.client import Client
FEE = 0.0005
PRIMARY = ['ETH', 'USDT', 'BTC', 'BNB']
@carlos8f
carlos8f / gist:9b559bf010c32d2342eb15e4de81e46b
Created May 28, 2017 05:41
zenbot sim result, 1m period, 4 days, gdax.BTC-USD, 59.11% profit, 63.32% over buy/hold
zenbot sim gdax.BTC-USD --trend_ema 21 --period 1m --max_slippage 0.001 --order_adjust_time 5000 --oversold_rsi_periods 13 --oversold_rsi 14 --neutral_rate 0.01 --days 4
start: 2017-05-23 16:07:00
end: 2017-05-27 22:37:00
{
"asset_capital": 0,
"buy_pct": 98,
"buy_stop_pct": 0,
"currency_capital": 1000,
@carlos8f
carlos8f / gist:8367d1d1aeb83062457f293425ec0e03
Created May 28, 2017 05:36
zenbot sim result, 1m period, gdax.ETH-USD, 4 days, 72.97% profit, 68.77% over buy/hold
zenbot sim gdax.ETH-USD --trend_ema 21 --period 1m --max_slippage 0.001 --order_adjust_time 5000 --oversold_rsi_periods 13 --oversold_rsi 14 --neutral_rate 0.01 --days 4
start: 2017-05-23 16:07:00
end: 2017-05-27 22:30:00
{
"asset_capital": 0,
"buy_pct": 98,
"buy_stop_pct": 0,
"currency_capital": 1000,
@jperl
jperl / Sizes.md
Created October 30, 2014 17:40
Meteor App Icon and Launch Screen Size Guide

###Icons

Name Size
iphone_2x 120x120
iphone_3x 180x180
ipad 76x76
ipad_2x 152x152
android_ldpi 36x36
android_mdpi 48x48
@tanmaykm
tanmaykm / pywebsock.html
Last active July 25, 2019 09:51
Minimal WebSocket Broadcast Server in Python
<!DOCTYPE html>
<html>
<head>
<title>Websocket Demo</title>
<style>
#messages {
border: dotted 1px #444444;
font: 12px arial,sans-serif;
}