Skip to content

Instantly share code, notes, and snippets.

View shurru's full-sized avatar

Shruthi shurru

  • Oakland, California
View GitHub Profile
@app.route('/retrieve', methods= ['GET'])
def retriever():
# can be made even more condensed (sure of it)
a= []
b=[]
run=[]
tim=[]
a2= []
b2=[]
@app.route('/insert', methods=['POST', 'GET'])
def dumper():
if request.method == 'POST':
# var= request.data
var= request.args.get('data')
var2= request.data
result= {"O1":var}
print result
print var2
posts.insert(result)
from flask import Flask, render_template
from pymongo import MongoClient
#setting up the flask app
app=Flask(__name__)
#connecting to mongoDB
client=MongoClient('localhost', 27017)
db=client.emosis
@app.route('/update', methods=['POST'])
def mongoupdate():
<pymongo code here>
@app.route('/retrieve', methods=['GET'])
def mongosend():
<pymongo code here>
def mongoupdate(self):
client= MongoClient('localhost')
# client= MongoClient('128.199.248.15',27017)
db=client.emosis
for i in xrange(0,len(self.O1save)):
post= {"date": self.date[i/4],
"O1": self.O1save[i],
"O2": self.O2save[i],
"fftO1":self.ffto1[i/4],
def savecsv(self):
self.O1save.append(self.ys[508])
self.O1save.append(self.ys[509])
self.O1save.append(self.ys[510])
self.O1save.append(self.ys[511])
self.O2save.append(self.ys2[508])
self.O2save.append(self.ys2[509])
self.O2save.append(self.ys2[510])
self.O2save.append(self.ys2[511])
self.ffto1.append(self.pwr)
curl http://127.0.0.1:8000/snippets/
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="robots" content="NONE,NOARCHIVE">
<title>SyntaxError at /snippets/</title>
<style type="text/css">
html * { padding:0; margin:0; }
def plotSomething():
if epoc.newRecord == False or epoc.fftcheck == True or epoc.plot_check == False or epoc.stop==True:
return
xs = numpy.arange(0, 511)
c.setData(xs, epoc.ys)
uiplot.qwtPlot.replot()
update= epoc.ys[508]
up2= numpy.int32(update)
import xively
import datetime
import sys
import time
import xml.etree.ElementTree as etree
import numpy
XIVELY_API_KEY= "OXrsK9MwFkcLIJvMRlAouni0TBSYPbT2ZU3tuPpP2uqTZfxi"
XIVELY_FEED_ID= 146826075
@shurru
shurru / gist:7578087
Created November 21, 2013 08:50
FFT on Arduino
#include <math.h>
int Voice = A0; // select the input pin for the potentiometer
int sensorValue=0;
void setup() {
Serial.begin(115200);
pinMode(Voice, INPUT);
}