Skip to content

Instantly share code, notes, and snippets.

View kaihansen79's full-sized avatar

Kai Hansen kaihansen79

  • P.S
  • Portland, OR
View GitHub Profile
#!/usr/bin/env python
import serial, time, datetime, sys
import eeml
from xbee import xbee
import sensorhistory
from time import sleep
import optparse
import smbus
import time, datetime
import sys
import traceback
def formatExceptionInfo(maxTBlevel=5):
cla, exc, trbk = sys.exc_info()
excName = cla.__name__
try:
excArgs = exc.__dict__["args"]
except KeyError:
excArgs = "<no args>"
if (((time.time() - sensorhistory.fiveminutetimer) >= 60.0)
and (currminute % 2 == 0)
):
wattsused = {}
whused = {}
# Taking avgwattover5min from ALL or only one sensor => erronious KWh
for history in sensorhistories.sensorhistories:
wattsused[history.sensornum] += history.avgwattover5min()
whused[history.sensornum]+= history.dayswatthr
#!/usr/bin/env python
import serial, time, datetime, sys
import eeml
from xbee import xbee
import sensorhistory
from time import sleep
import optparse
import smbus
@kaihansen79
kaihansen79 / gist:6437340
Last active May 13, 2016 11:09
People tracker & tagger with C++ OpenCV
#include <opencv2/opencv.hpp>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "highgui.h"
#include <stdlib.h>
#include <stdio.h>
#include "opencv2\video\background_segm.hpp"
#include <Windows.h>