Skip to content

Instantly share code, notes, and snippets.

View hbradio's full-sized avatar

Brady Hurlburt hbradio

View GitHub Profile
def myfunc():
x = lib.get_thing()
return x+1
myfunc()
class GridView(BaseView):
grid_cls = None
template = 'grid-view.html'
title = None
def get(self):
return self.render_grid()
def render_grid(self):
if self.grid_cls is None:

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:

@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
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
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
print "plaid"
quit()
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)
FROM debian:stable
MAINTAINER Clifton Barnes <clifton.a.barnes@gmail.com>
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 <clifton.a.barnes@gmail.com>
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