Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Binary Reader/binary_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
message_types = [0,"Status","IMU-Pitch","Altitude"]

def main():
f = open('C:\Python27\Projects\Binary Reader\data.bin','r')
f = open('data.bin','r')
data = f.read()
messages = []

valid = True
i = 0
while (i < len(data)):
while i < len(data):
message_id = message_types[ord(data[i])]
message_size = ord(data[i+1])
if message_size == 1:
Expand All @@ -25,9 +25,9 @@ def main():
def process_messages(messages):
for message in messages:
id,size,data = message
print id, size, data
print(id, size, data)


if __name__ == "__main__":
main()
raw_input("Press Enter to continue")
input("Press Enter to continue")
9 changes: 9 additions & 0 deletions Bottle/cookies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from bottle import route, run, template

@route('/hello')
def hello_again():
if request.get_cookie("visited"):
return "Welcome back! Nice to see you again"
else:
response.set_cookie("visited", "yes")
return "Hello there! Nice to meet you"
20 changes: 20 additions & 0 deletions Bottle/login.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from bottle import get, post, request # or route

@get('/login') # or @route('/login')
def login():
return '''
<form action="/login" method="post">
Username: <input name="username" type="text" />
Password: <input name="password" type="password" />
<input value="Login" type="submit" />
</form>
'''

@post('/login') # or @route('/login', method='POST')
def do_login():
username = request.forms.get('username')
password = request.forms.get('password')
if check_login(username, password):
return "<p>Your login information was correct.</p>"
else:
return "<p>Login failed.</p>"
Loading