Skip to content

Instantly share code, notes, and snippets.

View debovis's full-sized avatar

John DeBovis debovis

View GitHub Profile
@debovis
debovis / energyProfile.json
Created August 7, 2012 20:08
req.session object
{
"lastAccess": 1344369242137,
"cookie": {
"originalMaxAge": 14459999,
"expires": "2012-08-07T23:55:01.331Z",
"httpOnly": true,
"path": "/"
},
"gaas": {
"roles": [
@debovis
debovis / va.json
Created August 13, 2012 16:55
all VA buildings tenant
{
"id": 2,
"slug": "va",
"sites": [
{
"id": 21,
"parentSlug": null,
"name": "2011 Crystal Drive",
"slug": "nnn",
"status": 2,
@debovis
debovis / nes.txt
Created October 18, 2012 16:02
Named Entities for a month in sparcets
{
"data": [
{
"date": "05/09/2012",
"nes": {
"Feeding": 1,
"Sendgrid": 1,
"AIDE": 1,
"Our Local Foods": 1,
"CPR": 3,
@debovis
debovis / werkzeugProfiler.py
Created November 12, 2014 15:59
werkzeug profiler
from werkzeug.contrib.profiler import ProfilerMiddleware
app.config['PROFILE'] = True
app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30])
app.run( host='0.0.0.0', port=8081, threaded=True, debug=debug )
@debovis
debovis / jsonresponse.py
Last active August 29, 2015 14:10
Python Flask return JSON Response Exception
json_headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
res = Response(headers=json_headers)
res.set_data(data)
res.status_code = 400
raise abort(res)
@debovis
debovis / Angular-Material-Muppet-App.markdown
Created February 13, 2015 01:03
Angular Material Muppet App
@debovis
debovis / show_logging.py
Created May 14, 2015 15:51
See all invoked python loggers
import logging
print logging.Logger.manager.loggerDict
111464203307_10153923391928308 1
111464203307_10153905709378308 1
111464203307_10153905658238308 1
111464203307_10153975624618308 1
357425591250_10153811029651251 0
357425591250_10153730759216251 0
357425591250_10153776969171251 0
521013254686171_878357745618385 0
521013254686171_882051175249042 0
521013254686171_874585225995637 0
with app.app_context():
output = []
for rule in app.url_map.iter_rules():
methods = ','.join(rule.methods)
line = urllib.unquote("{:50s} {:20s} {}".format(rule.endpoint, methods, rule))
output.append(line)
for line in sorted(output):
print line
from sklearn.metrics import classification_report
import matplotlib.pylab as plt
import numpy as np
class ts_classifier(object):
def __init__(self,plotter=False):
'''
preds is a list of predictions that will be made.