Skip to content

Instantly share code, notes, and snippets.

View hbradio's full-sized avatar

Brady Hurlburt hbradio

View GitHub Profile
@app.route('/')
def home():
print 'in webpage server'
return send_from_directory('', 'index.html')
@app.route('/<path:path>')
def send_static_root(path):
print "in send_static_root"
print "getting " + path
return send_from_directory('', path)
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
# default listening port for IPv6 falls back to the IPv4 port
## Use ipv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
FROM debian:stable
MAINTAINER Clifton Barnes <[email protected]>
RUN apt-get update
RUN apt-get install -y python python-dev python-pip python-smbus nginx build-essential libssl-dev
RUN pip install flask flask-socketio gevent uwsgi
EXPOSE 80
FROM debian:stable
MAINTAINER Clifton Barnes <[email protected]>
RUN apt-get update
RUN apt-get install -y python python-dev python-pip python-smbus nginx build-essential libssl-dev
RUN pip install flask flask-socketio gevent uwsgi
EXPOSE 80
def twos_compl(val):
lsb = 1.0/2**15
if (val < -1.0) or (val > 1.0-lsb):
raise ValueError("Out of range")
if (val > 0):
return np.binary_repr(int(val/lsb),16)
else:
return np.binary_repr(int(2**15 - (1.0 + val)/lsb), 16)
print "plaid"
quit()
Register Hex Register Name Reset Value Current Value D7 D6 D5 D4 D3 D2 D1 D0
Register 0 0x00 Page Select 0x00 0x00 0 0 0 0 0 0 0 0
Register 1 0x01 Software Reset 0x00 0x00 0 0 0 0 0 0 0 0
Register 2 0x02 Revision ID 0x20 0x20 0 0 1 0 0 0 0 0
Register 3 0x03 Reserved 0x00 0x00 0 0 0 0 0 0 0 0
Register 4 0x04 Clock-Gen Muxing 0x00 0x03 0 0 0 0 0 0 1 1
Register 5 0x05 PLL-P and R-VAL 0x11 0x91 1 0 0 1 0 0 0 1
Register 6 0x06 PLL-J VAL 0x04 0x08 0 0 0 0 1 0 0 0
Register 7 0x07 PLL D-VAL MSB 0x00 0x00 0 0 0 0 0 0 0 0
Announcing rovercode
I'm pleased to announce the open-source project rovercode and make a call for developers!
Docs: http://rovercode-web.readthedocs.io/
Homepage: https://beta.rovercode.com/
License: GPLv3
rovercode is an educational robotics platform. It features a Blockly web app to make it easy to program and run your robot (rover) straight from your browser. Drag and drop commands to:
- drive motors
@hbradio
hbradio / using_requests_with_django.py
Created June 11, 2017 16:30
An example of using Python requests to log in and post data to your Django API
import requests
LOGIN_URL = "http://mydjangosite.com/accounts/login/"
ENDPOINT_URL = 'http://mydjangosite.com/myendpoint/'
'''
Create a session.
A session will automatically store the cookies that Django
sends back to you, like the csrf token and a the session id. You
could do it without the session, but then you'd have to save off the

Keybase proof

I hereby claim:

  • I am aninternetof on github.
  • I am bradyhurlburt (https://keybase.io/bradyhurlburt) on keybase.
  • I have a public key whose fingerprint is 4FAA 4B51 BE09 CDA3 C12E EDC6 E85C B57A 06A7 CEB6

To claim this, I am signing this object: