This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/op' do | |
consumer_key = 'key' | |
consumer_secret = 'secret' | |
url = 'https://openpaths.cc/' | |
now = Time.now | |
#instantiate client | |
client = OAuth2::Client.new(consumer_key, consumer_secret, :site => url) | |
#create token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest_client' | |
get '/withings' do | |
userid = 'id' | |
public_key = 'key' | |
now = Time.now.to_i | |
yestr = now - (24 * 60 * 60) | |
url = 'http://wbsapi.withings.net/measure?action=getmeas&userid=' + userid + '&publickey=' + public_key +'&startdate=' + yestr.to_s + '&enddate=' + now.to_s ' + &limit=1'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fitgem' | |
client = Fitgem::Client.new( { | |
:consumer_key => 'consumer_key', | |
:consumer_secret => 'consumer_secret', | |
:token =>'access_token', | |
:secret => 'access_secret' | |
} ) | |
client.activities_on_date('today') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################### Fitbit Mixin ################### | |
import urllib | |
import tornado.auth | |
import tornado.httputil | |
import logging | |
class FitbitMixin(tornado.auth.OAuthMixin): | |
"""Fitbit OAuth authentication. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'crazylegs' | |
consumer_key = "your consumer key" | |
consumer_secret = "your consumer secret" | |
base_url = "https://openpaths.cc/api/1" | |
credentials = Credentials.new(consumer_key,consumer_secret) | |
url = SignedURL.new(credentials, base_url,'GET') | |
signed_url = url.full_url | |
res = HTTParty.get(signed_url) | |
parsed = JSON.parse(res.parsed_response) |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"info": {"last": "Schumer", "middle": "E.", "gender": "M", "religion": "Jewish", "birthday": "1950-11-23", "official_full": "Charles E. Schumer", "first": "Charles"}, "event": "born", "time": "-602967600"}, {"info": {"number": 1487, "docs_house_gov_postdate": null, "titles": [["short", "introduced", "I Love New York Tax Deduction Act of 2001"], ["official", "introduced", "A bill to amend the Internal Revenue Code of 1986 to encourage the patronage of the hospitality, restaurant, and entertainment industries of New York City."]], "sponsor": {"name": "Sen. Charles Schumer [D-NY]", "firstname": "Charles", "twitterid": "chuckschumer", "middlename": "E.", "gender": "male", "bioguideid": "S000148", "namemod": "", "birthday": "1950-11-23", "youtubeid": "SenatorSchumer", "sortname": "Schumer, Charles (Sen.) [D-NY]", "lastname": "Schumer", "gender_label": "Male", "osid": "N00001093", "pvsid": "26976", "nickname": "", "id": 300087, "cspanid": 5929}, "id": 119704, "thomas_link": "http://thomas.loc.gov/cgi-bin/bdquery/ |
We can't make this file beautiful and searchable because it's too large.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
congress,committee_code,id_num,name,maj/min,rank_within_party_status,party,date_of_assignment,date_of_termination,senior_party_member,committee_seniority,committee_period_of_service,committee_status_at_end_of_congress,commitee_continuitiy_of_assignment_next_congress,appointment_citation,committee_name,state,cd,state_names,notes | |
103.0,305.0,14307.0,"Leahy, Patrick J.",1.0,1.0,100.0,1993-01-07 00:00:00,1995-01-03 00:00:00,,11.0,19.0,1.0,1.0,S. Res. 5,"Agriculture, Nutrition, and Forestry",6.0,83.0,VT | |
103.0,305.0,10791.0,"Pryor, David",1.0,2.0,100.0,1993-01-07 00:00:00,1995-01-03 00:00:00,,0.0,15.0,1.0,1.0,S. Res. 5,"Agriculture, Nutrition, and Forestry",42.0,82.0,AR | |
103.0,305.0,14700.0,"Boren, David L.",1.0,3.0,100.0,1993-01-07 00:00:00,1994-10-15 00:00:00,,0.0,15.0,8.0,0.0,S. Res. 5,"Agriculture, Nutrition, and Forestry",53.0,82.0,OK | |
103.0,305.0,14705.0,"Heflin, Howell",1.0,4.0,100.0,1993-01-07 00:00:00,1995-01-03 00:00:00,,0.0,13.0,1.0,1.0,S. Res. 5,"Agriculture, Nutrition, and Forestry",41.0,82.0,AL | |
103.0,30 |
We can't make this file beautiful and searchable because it's too large.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
congress,committee_code,id_num,name,maj/min,rank_within_party_status,party,date_of_assignment,date_of_termination,senior_party_member,committee_seniority,committee_period_of_service,committee_status_at_end_of_congress,commitee_continuitiy_of_assignment_next_congress,appointment_citation,committee_name,state,cd,state_names,notes | |
103.0,102.0,10716.0,"de la Garza, E. (Kika)",1.0,1.0,100.0,1993-01-05 00:00:00,1995-01-03 00:00:00,11.0,15.0,2.0,1.0,,AGRICULTURE,,,, | |
103.0,102.0,10573.0,"Brown, George E., Jr.",1.0,2.0,100.0,1993-01-05 00:00:00,1995-01-03 00:00:00,0.0,11.0,2.0,1.0,,AGRICULTURE,,,, | |
103.0,102.0,14048.0,"Rose, Charlie",1.0,3.0,100.0,1993-01-05 00:00:00,1995-01-03 00:00:00,0.0,11.0,2.0,1.0,,AGRICULTURE,,,, | |
103.0,102.0,14219.0,"English, Glenn L.",1.0,4.0,100.0,1993-01-05 00:00:00,1994-01-07 00:00:00,0.0,10.0,2.0,0.0,,AGRICULTURE,,,, | |
103.0,102.0,14444.0,"Panetta, Leon E.",1.0,5.0,100.0,1993-01-05 00:00:00,1993-01-21 00:00:00,0.0,9.0,2.0,0.0,,AGRICULTURE,,,, | |
103.0,102.0,14422.0,"Glickman, Daniel R.",1.0,6.0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for num in range(1,101): | |
if num % 3 == 0 and num % 5 == 0: | |
print "FizzBuzz" | |
elif num % 5 == 0: | |
print "Buzz" | |
elif num % 3 == 0: | |
print "Fizz" | |
else: | |
print num |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
This program computes my transportation-related carbon footprint using | |
Moves app data and the Brighter Planet carbon API. The Moves mobile | |
app tracks personal activity and displays it as a set of activity segments | |
like walking, running, and using transportation. I collected a sample of | |
transportation segments, labeled the transportation type | |
(car, airplane, subway etc), and then trained a ML algo |
OlderNewer