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/python | |
import time | |
import requests | |
import xml.etree.ElementTree as ET | |
my_latitude = 39.0548746 | |
url = 'http://ctabustracker.com/bustime/map/getBusesForRoute.jsp?route=' | |
route = str(input('Please select a bus route to view: ')) |
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 os | |
import collections | |
import random | |
import time | |
DataPoint = collections.namedtuple('DataPoint', 'id, x, y, temp, quality') | |
def main(): | |
print('Creating dataset.') | |
data_list = [] |
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/python | |
import os | |
import re | |
import requests | |
from bs4 import BeautifulSoup | |
url = 'http://random-name-generator.info' | |
hdr = { |
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
from django.contrib.auth.models import User | |
from django.core.cache import cache | |
from django.core.exceptions import ObjectDoesNotExist | |
from django.core.urlresolvers import reverse | |
from django.db import models | |
from django.db.models import Q | |
class Alert(models.Model): | |
SYSTEM_ALERT = 'system_alert' |
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
# models.py | |
from django.db import models | |
class Customer(models.Model): | |
company = models.ForeignKey('Company', null=False) | |
customer_first_name = models.CharField(null=False, blank=False, max_length=50) | |
customer_last_name = models.CharField(null=False, blank=False, max_length=50) | |
customer_email = models.CharField(null=False, blank=False, max_length=80) |
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
{% extends "base.html" %} | |
{% load bootstrap3 %} | |
{% load querystring from django_tables2 %} | |
{% load title from django_tables2 %} | |
{% load trans blocktrans from i18n %} | |
{% block "content" %} | |
{% if table.page %} |
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
from django.views.generic import ListView | |
from braces.views import LoginRequiredMixin, GroupRequiredMixin | |
from django_tables2 import RequestConfig | |
from .models import Customer | |
from .tables import CustomerTable | |
class CustomerListView(LoginRequiredMixin, GroupRequiredMixin, ListView): | |
model = Customer | |
template_name = 'customer_list.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
#! flask/bin/python | |
from flask import Flask, request, jsonify, abort, make_response, url_for | |
from flask_restful import Api, Resource, reqparse, fields, marshal | |
from flask_httpauth import HTTPBasicAuth | |
from datetime import datetime | |
import pyodbc | |
import json | |
import config |
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 Item(TimeStampedModel): | |
LEADTIME_PERIOD = ( | |
('D', 'DAYS'), | |
('W', 'WEEKS'), | |
('M', 'MONTHS'), | |
) | |
sku = models.CharField(max_length=50, blank=False, null=False) | |
item_name = models.CharField(max_length=50, blank=False, null=False) | |
item_description = models.TextField() |
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 Location(BaseAddress, TimeStampedModel): | |
location_name = models.CharField(max_length=50, blank=False, null=False) | |
default_location = models.BooleanField(default=False) | |
def __unicode__(self): | |
if self.location_name and self.city: | |
return unicode(str(self.location_name + '-' + self.city)) | |
class Meta: | |
verbose_name = 'Location' |