This file contains hidden or 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 tweepy | |
import json | |
from sqlite_utils import Database | |
def authenticate(): | |
# twitter API credentials | |
cred = json.load(open('.cred.json', 'r')) | |
auth = tweepy.OAuthHandler(consumer_key=cred['api_key'], consumer_secret=cred['api_secret_key']) | |
auth.set_access_token(key=cred['access_token'], secret=cred['access_token_secret']) | |
api = tweepy.API(auth) |
This file contains hidden or 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
{ | |
"cropHintsAnnotation": { | |
"cropHints": [ | |
{ | |
"boundingPoly": { | |
"vertices": [ | |
{ | |
"x": 89 | |
}, | |
{ |
This file contains hidden or 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 torch | |
import torch.nn.functional as F | |
import torchvision | |
import torchvision.models as models | |
import mlflow | |
import mlflow.pytorch | |
import numpy as np | |
class Model(mlflow.pyfunc.PythonModel): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 hidden or 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
annotation=> explain (analyze, timing off) select label, value from data limit 10000; | |
QUERY PLAN | |
------------------------------------------------------------------------------------------------ | |
Limit (cost=0.00..322.22 rows=10000 width=8) (actual rows=10000 loops=1) | |
-> Seq Scan on data (cost=0.00..33860.40 rows=1050840 width=8) (actual rows=10000 loops=1) | |
Total runtime: 5.994 ms | |
(3 rows) | |
Time: 6.801 ms |
This file contains hidden or 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
# Fizz Buzz in Tensorflow! | |
# see http://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/ | |
import time | |
import sys | |
import numpy as np | |
import tensorflow as tf | |
from utils import binary_encode, fizz_buzz_encode, fizz_buzz | |
#from models import gen, gen_all |
This file contains hidden or 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
open("/tmp/empty.json", O_RDONLY|O_CLOEXEC) = 12 | |
fstat(12, {st_mode=S_IFREG|0640, st_size=3, ...}) = 0 | |
ioctl(12, TCGETS, 0x3fffed9c8200) = -1 ENOTTY (Inappropriate ioctl for device) | |
lseek(12, 0, SEEK_CUR) = 0 | |
ioctl(12, TCGETS, 0x3fffed9c8170) = -1 ENOTTY (Inappropriate ioctl for device) | |
lseek(12, 0, SEEK_CUR) = 0 | |
lseek(12, 0, SEEK_CUR) = 0 | |
fstat(12, {st_mode=S_IFREG|0640, st_size=3, ...}) = 0 | |
read(12, "{}\n", 4) = 3 |
This file contains hidden or 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
def read_data(files, total_records): | |
records = [] | |
while len(records) < total_records: | |
# Rotate the files queue | |
files.rotate(1) | |
with open(files[0]) as handle: | |
data = json.load(handle) | |
for record in data: | |
records.append(record) | |
If len(records) >= total_records: |
This file contains hidden or 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
from sqlalchemy import func, select, Column, ForeignKey, Integer, String, create_engine | |
from sqlalchemy.orm import sessionmaker, relationship | |
from sqlalchemy.sql.expression import literal_column | |
from sqlalchemy.ext.declarative import declarative_base | |
Base = declarative_base() | |
engine = create_engine('postgresql+psycopg2://postgres:password@localhost/test', echo=True) | |