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 mechanize | |
from BeautifulSoup import BeautifulSoup | |
URL = "http://www.airfarewatchdog.com/" | |
def input_destination(dest): | |
br = mechanize.Browser() | |
br.open(URL) | |
formcount = 0 | |
for form in br.forms(): |
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 os.path | |
import json | |
from flask import request, Response, url_for, send_from_directory | |
from werkzeug.utils import secure_filename | |
from jsonschema import validate, ValidationError | |
import models | |
import decorators | |
import analysis |
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 create_engine | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String, Boolean, Text | |
from sqlalchemy import ForeignKey | |
from sqlalchemy.orm import relationship, backref | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy import Table | |
from sqlalchemy.schema import UniqueConstraint | |
import logging |
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 create_engine | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String, Boolean, Text | |
from sqlalchemy import ForeignKey | |
from sqlalchemy.orm import relationship, backref | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy import Table | |
from sqlalchemy.schema import UniqueConstraint | |
import logging |
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 create_engine | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String, Boolean, Text | |
from sqlalchemy import ForeignKey | |
from sqlalchemy.orm import relationship, backref | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy import Table | |
from sqlalchemy.schema import UniqueConstraint | |
import logging |
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
if (!exists(".inflation")) { | |
.inflation <- getSymbols('CPIAUCNS', src = 'FRED', | |
auto.assign = FALSE) | |
} | |
# adjusts yahoo finance data with the monthly consumer price index | |
# values provided by the Federal Reserve of St. Louis | |
# historical prices are returned in present values | |
adjust <- function(data) { |
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
SELECT pet.id, pet.name, pet.dead, pet.breed_id, pet.adopted | |
FROM pet, breed, species | |
WHERE | |
pet.breed_id = breed.id AND | |
breed.species_id = species.id AND | |
species.id = 2; | |
UPDATE pet SET adopted = 0 IN ( | |
SELECT pet.adopted | |
FROM pet, breed, species |
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
CREATE TABLE species ( | |
id INTEGER PRIMARY KEY, | |
name TEXT | |
); | |
CREATE TABLE breed ( | |
id INTEGER PRIMARY KEY, | |
name TEXT, | |
species_id INTEGER | |
); |
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
#Evaluate Poker Hands at the flop in Texas Hold'em | |
import collections | |
#Some Constants | |
VALUES = ["A","2","3","4","5","6","7","8","9","10","J","Q","K"] | |
SUITS = ["s","h","d","c"] | |
HIGH_STRAIGHT = ["10", "J", "Q", "K", "A"] | |
#Helper function to check input | |
def check_card(card): |