Skip to content

Instantly share code, notes, and snippets.

View benjaminmbrown's full-sized avatar
💭
Visit Chainwave.io

Benjamin Michael Brown benjaminmbrown

💭
Visit Chainwave.io
View GitHub Profile
<html>
<head>
<meta charset="utf-8">
<title>Dimensional Charting</title>
<link rel="stylesheet" type="text/css" href="http://dc-js.github.io/dc.js/css/dc.css"/>
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/d3.js"></script>
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/crossfilter.js"></script>
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/dc.js"></script>
</head>
class WebSocketHandler(websocket.WebSocketHandler):
def open(self):
print 'Connection established.'
#close connection
def on_close(self):
print 'Connection closed.'
# Our function to send new (random) data for charts
@benjaminmbrown
benjaminmbrown / websocket_server.py
Last active February 19, 2016 20:14
Python imports for websocket_server.py
#!/usr/bin/env python2.7
import json
import random
from tornado import websocket, web, ioloop
import datetime
from time import time
# Random number generator
r = lambda: random.randint(0,255)