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
-module(zmq_streamer). | |
-behaviour(gen_fsm). | |
-export([start_link/3, start_link/4]). | |
%% gen_fsm callbacks | |
-export([init/1, handle_event/3, handle_sync_event/4, handle_info/3, | |
terminate/3, code_change/4]). | |
-export([get_count/1, stop/1]). | |
-record(state, {zmq_context=undefined, pull_socket=undefined, xrep_socket=undefined, next_cons_identity, count=0}). | |
-define(SERVER, ?MODULE). |
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({set_alarm, {process_memory_high_watermark, Pid}}, State) -> | |
error_logger:info_msg("*** Process high mark reached ~p ~n", [Pid]), | |
error_logger:info_msg("*** Backtrace - ~p ~n ", [erlang:process_info(Pid, backtrace)]), | |
error_logger:info_msg("*** Process info ~p ~n", [erlang:process_info(Pid)]), | |
{ok, State}; |
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({lookup_popular_replies, TweetId, AuthorId}, _From, #state{client=Client} = State) -> | |
% reduce fun to get valid tweet keys in tweet response bucket phase 3 | |
Fun = make_local_fun("fun(O, _) -> | |
lists:foldl(fun | |
([LinkedTweet = <<Id:128>>, <<Val:128>>, <<\"reply\">>], Acc) -> | |
[{{<<\"tweet_responses_bucket\">>, LinkedTweet}, {Id, Val}} | Acc]; | |
({{<<\"tweet_responses_bucket\">>, _}, _} = PreviousPass, Acc) -> | |
[PreviousPass | Acc]; | |
(_, Acc) -> | |
Acc |
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
from httplib import HTTP | |
import location | |
latitude = 0 | |
longitude = 0 | |
def doLookup(cellId, lac, host = "www.google.com", port = 80): | |
from string import replace | |
from struct import unpack | |
page = "/glm/mmap" |
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
-module(simhash). | |
-define(HASH_RANGE, 1 bsl 128). | |
-define(HASH_ACCU, 12). | |
-define(HASH_WIDTH, 128). | |
-export([hash_file/1]). | |
hash_file(File) -> | |
{ok, Binary} = file:read_file(File), | |
Tokens = re:split(Binary, "\\W"), |
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
-module(twitter_stream). | |
-author('[email protected]'). | |
%% | |
%% Copyright (c) 2009, Jebu Ittiachen | |
%% All rights reserved. | |
%% | |
%% Redistribution and use in source and binary forms, with or without modification, are | |
%% permitted provided that the following conditions are met: | |
%% | |
%% 1. Redistributions of source code must retain the above copyright notice, this list of |