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
import requests | |
import json | |
import pandas | |
import pylab as plt | |
import auth | |
# Get auth token | |
r = requests.post("https://jawbone.com/user/signin/login", { |
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
import json | |
import pandas | |
import pylab as plt | |
#Load data | |
M = [json.loads(l) for l in file("data/snapshots.jl", 'r').readlines()] | |
#Day step graph | |
D = pandas.DataFrame(M[2]["data"]) |
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
import sqlite3 | |
import pandas | |
import re | |
#cp ~/Library/Application\ Support/Google/Chrome/Default/History ./History | |
sql = sqlite3.connect("History") | |
c = sql.cursor() | |
#List table creation commands to introspect schemas |
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
class OpenTemplateHandler(tornado.web.RequestHandler): | |
def get_current_user(self): | |
return json.loads(self.get_secure_cookie("myapp-user")) | |
def get(self, path): | |
self.render(path+'.html') | |
class ApiHandler(BaseHandler): | |
@tornado.gen.coroutine | |
def get(self, path): |
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
""" | |
Fetch current traffic conditions from http://traffic.calit2.net/bayarea/ and save them to a timestamped file. | |
""" | |
import re | |
import json | |
import codecs | |
import datetime | |
import requests | |
from lxml import html |
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
""" | |
watcher.py | |
A nifty little script for responsive coding ala Brackets, but in python | |
It watches a directory for file changes, then executes an aribtrary python script. | |
Imports and large data loads can be cached at setup so that the remaining code can execute very fast. | |
See more about intended use case here: | |
http://stackoverflow.com/questions/32997698/auto-run-a-python-script-without-reloading-dependencies |
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
import random | |
import names | |
# http://treyhunner.com/2013/02/random-name-generator/ | |
import pandas as pd | |
k = 10 | |
gender = [random.choice(['male', 'female']) for i in range(k)] | |
users = pd.DataFrame({ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
""" | |
Example code to download all posts that an actor has Liked from BlueSky | |
Uses the psychonaut implementation of ATProtocol. | |
""" | |
import json | |
from typing import List | |
from psychonaut.client import get_simple_client_session | |
from psychonaut.client.cursors import collect_cursored |