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 TokenBucket: | |
def __init__(self, rate=5.0, per=1.0): | |
self.rate = rate # unit: messages | |
self.per = per # unit: seconds | |
self.allowance = rate # unit: messages | |
self.last_check = time() # floating-point, e.g. usec accuracy. Unit: seconds | |
def getToken(self): | |
current = time() |
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
#include <boost/property_tree/ptree.hpp> | |
#include <boost/property_tree/json_parser.hpp> | |
#include <boost/foreach.hpp> | |
#include "boost/filesystem.hpp" | |
#include "boost/regex.hpp" | |
#include <iostream> | |
#include <string> | |
using namespace boost::filesystem; |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import RecursiveContents | |
import Data.Aeson | |
import qualified Data.Aeson.Types as T | |
import Data.Attoparsec (parse, Result(..), IResult(..)) | |
import Data.Text (Text) | |
import Control.Applicative ((<$>), (<*>)) | |
import Control.Monad (mzero, liftM) | |
import qualified Data.ByteString.Char8 as BS |
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
for(int i=0; i<COLOR_COUNT_MAX; i++){ | |
myLUTp[i] = (big_originalColorsHist[i] != 0) ? floor(color_sum[i]/(big_originalColorsHist[i]) + 0.5) : 0; | |
constareaLUTp[i] = (big_constareaColorsHist[i] == 0) ? 0 : floor(constarea_color_sum[i]/(big_constareaColorsHist[i]) + 0.5) ; | |
} |
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
cmp dword ptr [rbp+r15*4+0x1b70], 0x0 | |
jnz 0x14000c06d | |
pxor xmm0, xmm0 | |
jmp 0x14000c090 | |
xor edx, edx | |
mov eax, dword ptr [rbp+r15*4+0xb70] | |
mov ecx, dword ptr [rbp+r15*4+0x1b70] | |
div ecx | |
cvtsi2sd xmm0, rax | |
addsd xmm0, xmm6 |
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
def read_word(file_object): | |
buf = "" | |
data = file_object.read(1) | |
while True: | |
if data in stopsymbols: | |
if len(buf)>0: | |
break | |
else: | |
buf = buf + 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
handle_event {erlyvideo_event,user_play,undefined,<0.155.0>,undefined, | |
undefined,<0.171.0>,undefined, | |
[{stream_id,1}], | |
undefined} | |
debug 2011-09-08 14:37:15 [main] ems_media:593 {"No decoder config in stream, waiting",<<"vlc.ts">>} | |
error 2011-09-08 14:37:15 Error in process <0.179.0> on node 'ev@localhost' with exit value: {undef,[{erlywatcher_server,logshit,[]}]} | |
stream started <0.171.0> [{1,<0.179.0>}] | |
info 2011-09-08 14:37:19 PLAY 127.0.0.1 undefined 1315478234025626 vlc.ts 1 |
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
%%We need to store stream_id, because we have to dispatch frames to right loggers | |
handle_cast({stream_started, _Host, _StreamName, Stream, _Options}, #online_streams{streams = Streams}) -> | |
LoggerPid = spawn(?MODULE, logshit,[]), | |
StreamsList = dict:to_list(Streams), | |
NewStreamId = case length(StreamsList) of | |
N when N>0 -> lists:max([Key ||{Key, Value} <- dict:to_list(Streams)])+1; | |
_ -> 1 | |
end, | |
ems_media:play(Stream, [stream_id, NewStreamId]), | |
NewStreams = dict:store(NewStreamId, LoggerPid, Streams), |
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
handle_call({subscribe, Client, Options}, _From, #ems_media{module = M, clients = Clients, audio_config = A, media_info = MediaInfo, last_dts = DTS} | |
= Media) -> | |
StreamId = proplists:get_value(stream_id, Options), | |
DefaultSubscribe = fun(Reply, #ems_media{} = Media1) -> | |
Ref = erlang:monitor(process,Client), | |
RequireTicker = case Reply of | |
tick -> true; | |
notick -> false; | |
_ -> proplists:get_value(start, Options) =/= undefined |
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
hmax@hwork /media/portable/Projects/CV/local_morphological_diff_cmake/build $ make sparse_benchmark | |
[ 50%] Building CXX object src/CMakeFiles/sparse_benchmark.dir/sparse.cpp.o | |
[100%] Building CXX object src/CMakeFiles/sparse_benchmark.dir/sparse_methods.cpp.o | |
Linking CXX executable sparse_benchmark | |
CMakeFiles/sparse_benchmark.dir/sparse.cpp.o: In function `main': | |
sparse.cpp:(.text+0x1e5): undefined reference to `void cv::sparse_methods::bitwise_and<unsigned char>(cv::SparseMat_<unsigned char>&, cv::SparseMat_<unsigned char>&, cv::SparseMat_<unsigned char>&)' | |
collect2: выполнение ld завершилось с кодом возврата 1 | |
make[3]: *** [src/sparse_benchmark] Ошибка 1 | |
make[2]: *** [src/CMakeFiles/sparse_benchmark.dir/all] Ошибка 2 | |
make[1]: *** [src/CMakeFiles/sparse_benchmark.dir/rule] Ошибка 2 |
NewerOlder