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
the_list = [1, 3, 7, 9, 12, 3, 9, 12, 9, 10, 14, 23, 12] | |
def analyze_list(l): | |
counts = {} | |
for item in l: | |
if item in counts: | |
counts[item] += counts[item] | |
else: | |
counts[item] = 1 |
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
# -*- coding: utf-8 -*-byte1 ^ byte2 ^ | |
# xor_final.py | |
# vars | |
checksum = 0 | |
checksum_xor = 0 | |
n = 2 | |
# raw data | |
radio_09010 = '02040d3031000010723320000a100000363303' |
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
#!.env/bin/python | |
# -*- coding: utf-8 -*- | |
import socket | |
import sys | |
import binascii | |
# client vars | |
host = '0.0.0.0' | |
port = 8060 |
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
# .env/bin/python | |
# coding: utf-8 | |
from collections import namedtuple | |
from datetime import datetime | |
def pad_reading(_reading): | |
""" | |
Return a full binary representation of the individual bytes |
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
#!.env/bin/python | |
# -*- coding: utf-8 -*- | |
import socket | |
import sys | |
from db import db_session | |
from decoder import inspect_header, decode_header, decode_readings | |
from datetime import datetime | |
from models import Tx, TxHeader, TxReading | |
from sqlalchemy import exc |
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.orm import scoped_session, sessionmaker | |
from sqlalchemy.ext.declarative import declarative_base | |
engine = create_engine('mysql://user:pass@localhost/RadioData', convert_unicode=True, pool_pre_ping=True) | |
db_session = scoped_session(sessionmaker(autocommit=False, | |
autoflush=False, | |
bind=engine)) | |
Base = declarative_base() | |
session = db_session() |
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 db import Base | |
from datetime import datetime | |
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, Boolean, Text, Float | |
from sqlalchemy.orm import relationship | |
class RadioType(Base): | |
__tablename__ = 'radio_types' | |
id = Column(Integer, primary_key=True) |
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
@app.route('/api/v1.0/sms/<string:phone_number>', methods=['GET']) | |
def get_sms_data(phone_number): | |
""" | |
Append data to Mobile Number | |
Return the Person obj by cell phone number | |
:param: string: phone_number | |
:return: obj(Person), type(json) | |
""" | |
geo, carrier, time_zone, city_geocode = range(4) |
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 db import Base | |
from datetime import datetime | |
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, Boolean, Text, Float | |
from sqlalchemy.orm import relationship | |
from werkzeug.security import generate_password_hash, check_password_hash | |
import uuid | |
# Define application Bases | |
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 flask import Flask, Response, abort, request, jsonify, g, url_for, render_template, flash | |
from flask_mail import Mail, Message | |
from flask_sslify import SSLify | |
from flask_sqlalchemy import SQLAlchemy | |
from flask_httpauth import HTTPTokenAuth | |
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer | |
from sqlalchemy import exc, and_, desc | |
from celery import Celery | |
from datetime import datetime | |
from db import db_session |