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 | |
# Copyright 2014 Dan Krause | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
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 codecs | |
import csv | |
def csv_unireader(f, encoding="utf-8"): | |
for row in csv.reader(codecs.iterencode(codecs.iterdecode(f, encoding), "utf-8")): | |
yield [e.decode("utf-8") for e in row] |
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 Cache(object): | |
""" | |
>>> dec_cache = Cache(10) | |
>>> @dec_cache | |
... def identity(f): | |
... return f | |
>>> dummy = [identity(x) for x in range(20) + range(11,15) + range(20) + | |
... range(11,40) + [39, 38, 37, 36, 35, 34, 33, 32, 16, 17, 11, 41]] | |
>>> dec_cache.t1 | |
deque([(41,)]) |
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
var slowJob = Rx.Observable.defer(function () { | |
return Rx.Observable.return(Math.random() * 1000).delay(2000); | |
}); | |
var cached = slowJob.cacheWithExpiration(5000); | |
var last = Date.now(); | |
function repeat() { | |
last = Date.now(); | |
cached.subscribe(function (data) { |
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
#!/bin/bash | |
# Create an Iframe index from HLS segmented streams | |
# $1: Filename to be created | |
# $2: Location of segmented ts files | |
# Check how many arguments | |
if [ $# != 2 ]; then | |
echo "Usage: $0 [Input filename] [Location of segmented streams]" | |
exit 1; | |
fi |
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 SingleStateKalmanFilter(object): | |
def __init__(self, A, B, C, x, P, Q, R): | |
self.A = A # Process dynamics | |
self.B = B # Control dynamics | |
self.C = C # Measurement dynamics | |
self.current_state_estimate = x # Current state estimate | |
self.current_prob_estimate = P # Current probability of state estimate | |
self.Q = Q # Process covariance | |
self.R = R # Measurement covariance |
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
test |
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/env python3 | |
import sys | |
import graphviz | |
from glob import glob | |
import yaml | |
import logging | |
logging.basicConfig(level=logging.DEBUG) |
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
# Copyright 2014 Dan Krause | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |