Skip to content

Instantly share code, notes, and snippets.

View withr's full-sized avatar

Huidong Tian withr

View GitHub Profile
@withr
withr / _.R.js
Last active August 29, 2015 14:16 — forked from kosamari/_.R.js
_.mixin({
sum : function(data){
return _.reduce(data, function(memo, num){ return memo + num; }, 0);
},
mean : function(data){
return this.sum(data)/data.length
},
median : function(data){
return this.percentile(data,50);
},
@withr
withr / uustats.js
Last active August 29, 2015 14:16 — forked from olivoil/uustats.js
(function(uustats){
uustats.sdev = function(series) {
return Math.sqrt(uustats.variance(series));
};
uustats.variance = function(series) {
var t = 0, squares = 0, len = series.length;
for (var i=0; i<len; i++) {
@withr
withr / PiCameraStream
Last active August 29, 2015 14:15 — forked from nioto/PiCameraStream
#!/usr/bin/python
'''
A Simple mjpg stream http server for the Raspberry Pi Camera
inspired by https://gist.github.com/n3wtron/4624820
'''
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import io
import time
import picamera