Skip to content

Instantly share code, notes, and snippets.

View Techmind's full-sized avatar

Bogunov Ilya Techmind

View GitHub Profile
@Techmind
Techmind / player locations.txt
Created April 18, 2011 20:44
player locations
;
32,1;povar345;POWER OF DARKNESS;
102,1;wolfik32;;
147,1;Варлорд;;
160,2;Jettorio;;
183,256;Vassekho;;
187,2;ElPresident;;
206,256;Dmi3;Inferno;
240,256;Ir0nF1st;;
16,4;Sanches;POWER OF DARKNESS;
class User
include Buyer
include BuyerWithShotgun
end
class Buyer
private money
def canPay(price)
money > price
end
[CategoryFrameIoList, CategoryFrameSize] =
if WriteCategory == true ->
[[CategorySize = byte_size(Category), Category], CategorySize + 4];
true -> [[], 0]
end,
{ok, Client} = riak:client_connect('riak@192.168.11.123').
Mine = riak_object:new(<<"groceries">>, <<"mine">>, ["eggs", "bacon"]).
Yours = riak_object:new(<<"groceries">>, <<"yours">>, ["bread", "bacon"]).
Client:put(Yours, 1).
Client:put(Mine, 1).
Map = fun(G, 'undefined', 'none')->[G] end.
Reduce = fun(Glist, 'none') -> Glist end.
@Techmind
Techmind / gist:1315813
Created October 26, 2011 08:49
riak search ru stemmer
-module(ru_stem).
-export([
standard_analyzer_factory/2
]).
-define(UPPERCHAR(C), (C >= $A andalso C =< $Z) orelse (C >= 1040 andalso C =< 1071)).
-define(LOWERCHAR(C), (C >= $a andalso C =< $z) orelse (C >= 1072 andalso C =< 1103)).
-define(NUMBER(C), (C >= $0 andalso C =< $9)).
-define(WHITESPACE(C), ((C == $\s) orelse (C == $\n) orelse (C == $\t) orelse (C == $\f) orelse (C == $\r) orelse (C == $\v))).
@Techmind
Techmind / gist:1475874
Created December 14, 2011 09:32
Вопросы по риаку.
Потому было б интересно услышать по ваш опыт использования Риака. Что у вас за система (в общем виде и как в ней юзаеться риак.)
Юзали ли серьезно мап-редьюс, как делали индексы(прикручивали ли поиск ?\2i), какие самые большие проблемы были и как обходили.
Если есть еще знакомые с опытом использования риака меня можно пнуть в их сторону(Льва Валкина еще спрошу, но и так неплохо знаю как у них система работает, он пишет подбробно + общался с парой человек из их команды =)).
Package: erlang
State: installed
Automatically installed: no
Version: 1:13.b.3-dfsg-2ubuntu2.1
Priority: optional
Section: universe/interpreters
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Uncompressed Size: 86.0k
Depends: erlang-base | erlang-base-hipe, erlang-dev, erlang-appmon, erlang-asn1, erlang-common-test, erlang-corba, erlang-crypto, erlang-debugger,
erlang-dialyzer, erlang-docbuilder, erlang-edoc, erlang-erl-docgen, erlang-et, erlang-eunit, erlang-gs, erlang-ic, erlang-inets,
ALTER TABLE actions_0 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_1 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_10 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_100 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_101 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_102 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_103 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_104 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_105 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_106 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_0 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_1 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_10 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_100 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_101 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_102 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_103 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_104 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_105 DROP INDEX `type`, DROP INDEX `param`;
ALTER TABLE actions_106 DROP INDEX `type`, DROP INDEX `param`;
./cli jobs/tools/multi_run --count=8 --code='$db = $factory->getDaemonActionsBackend("riak"); $redis = $factory->getRedis();$file = $factory->getDaemonActionsBackend("file"); while ($id = $redis->popFromList("testList2")) { $actions = $file->getUserActions($id, null, array(), 5000); $actions[0] = array_reverse($actions[0]); $db->writeActions($actions[0], $id);}'
./cli jobs/tools/multi_run --count=8 --code='$db = $factory->getDaemonActionsBackend("db_sharded"); $redis = $factory->getRedis();$file = $factory->getDaemonActionsBackend("file"); while ($id = $redis->popFromList("testList3")) { $actions = $file->getUserActions($id, null, array(), 5000); $actions[0] = array_reverse($actions[0]); $db->writeActions($actions[0], $id);}'