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
# -*- coding: utf-8 -*- | |
''' | |
Created on 2014-04-05 | |
@author: Sergey Prokhorov <me@seriyps.ru> | |
''' | |
import re | |
import operator | |
import decimal |
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
%% Usage: | |
%% TemplatesDir = "templates", | |
%% TemplatesNames = ["index.dtl", "_layout.dtl"], % filelib:wildcard("*.dtl", TemplatesDir) | |
%% LocalesDir = "locales", | |
%% Domain = "my_project", % phrases will be written to "locales/my_project.pot" | |
%% Messages = extract_messages(TemplatesDir, TemplatesNames), | |
%% write_pot(Messages, LocalesDir, Domain). | |
-module(erlydtl_xgettext). |
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 | |
# -*- coding: utf-8 -*- | |
''' | |
Created on 2012-06-03 | |
@author: Sergey Prokhorov <me@seriyps.ru> | |
Скрипт для создания архива, содержащего все пакеты, необходимые для оффлайн | |
установки l2tp плагина NetworkManager на Ubuntu. | |
''' |
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
decode_data(Data, UserAgent, Fuid01) -> | |
Key = iolist_to_binary([binary:part(UserAgent, 0, min(25, size(UserAgent))), | |
Fuid01, | |
<<"I keep watch over you ;)">>]), | |
decode_chars(Data, Key, 0). | |
decode_chars(<<>>, _, _) -> | |
<<>>; | |
decode_chars(<<Char:8, Rest/binary>>, Key, Idx) -> | |
KeyPos = Idx rem size(Key), |
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
%%% @author Sergey Prokhorov <me@seriyps.ru> | |
%%% @copyright (C) 2013, Sergey Prokhorov | |
%%% @doc | |
%%% Simple gettext .mo file format parser for Erlang. | |
%%% | |
%%% Produce [{KeyPlurals::[binary()], TransPlurals::[binary()]}] orddict as | |
%%% output. | |
%%% Eg, for .po file (converted to .mo) | |
%%% <pre> | |
%%% msgid "Download" |
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
# -*- coding: utf-8 -*- | |
''' | |
Created on 2012-10-07 | |
@author: Sergey <me@seriyps.ru> | |
Альтернативный вариант решения из статьи http://habrahabr.ru/post/153595/ | |
на базе модификации AST | |
@asynchronous |
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
is_exported(M, F, A) -> | |
%% make a cheap test first to avoid unnecessary calls to code server | |
case erlang:module_loaded(M) of | |
false -> code:ensure_loaded(M); | |
true -> ok | |
end, | |
erlang:function_exported(M, F, A). |
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
%% Prints source code of a function. | |
%% | |
%% Requires debug_info | |
%% Will not work for modules mocked by meck | |
%% | |
%% > io:format("~s~n", [rf:print_function(dict, new, 0)]). | |
%% new() -> | |
%% Empty = mk_seg(16), | |
%% #dict{empty = Empty, segs = {Empty}}. |
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
%%% @author sergey <me@seriyps.ru> | |
%%% @copyright (C) 2018, sergey | |
%%% @doc | |
%%% Given a liast of resources M and list of users N, N > M; | |
%%% Any resourse might be acquired by one or more users (by request from user). | |
%%% There is no bound on how many users can acquire single resource. | |
%%% User may release resource at any time. | |
%%% User must get resource that is used by least amount of other users. | |
%%% @end | |
%%% Created : 8 Oct 2018 by sergey <me@seriyps.ru> |
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(proper_json). | |
-export([json/0, json/1]). | |
json() -> | |
?SIZED(Size, json(Size)). | |
json(0) -> | |
j_literal(); |
OlderNewer