This file contains hidden or 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 <[email protected]> | |
Скрипт для создания архива, содержащего все пакеты, необходимые для оффлайн | |
установки l2tp плагина NetworkManager на Ubuntu. | |
''' |
This file contains hidden or 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-09-24 | |
@author: Sergey <[email protected]> | |
How to test: | |
$ head -c 100M /dev/urandom > static_file.bin | |
$ python |
This file contains hidden or 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 <[email protected]> | |
Альтернативный вариант решения из статьи http://habrahabr.ru/post/153595/ | |
на базе модификации AST | |
@asynchronous |
This file contains hidden or 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 <[email protected]> | |
%%% @copyright (C) 2013, Sergey Prokhorov | |
%%% @doc | |
%%% @license Apache License Version 2.0 | |
%%% | |
%%% Walker alias method - efficient random selection with defined probabilities. | |
%%% <http://en.wikipedia.org/wiki/Alias_method> | |
%%% | |
%%% > ProbabilityValueList = [{10, a}, {20, b}, {30, c}, {40, d}], | |
%%% > WalkerVectors = walker_alias:build(ProbabilityValueList), |
This file contains hidden or 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 hidden or 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
% Send plaintext email using gen_smtp https://github.com/Vagabond/gen_smtp | |
% This function sends email directly to receiver's SMTP server and don't use MTA relays. | |
% | |
% Example plaintext email: | |
% Mail = mail_plain(<<"Bob <[email protected]>">>, <<"Alice <[email protected]>">>, <<"The mail subject">>, <<"The mail body">>), | |
% send_email(Mail). | |
% | |
% Example email with image attachment: | |
% ImgName = "image.jpg", | |
% {ok, ImgBin} = file:read_file(ImgName), |
This file contains hidden or 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 <[email protected]> | |
%%% @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 hidden or 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 <[email protected]> | |
''' | |
import re | |
import operator | |
import decimal |
This file contains hidden or 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 hidden or 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
#![feature(phase)] | |
#[phase(plugin, link)] extern crate log; | |
extern crate green; | |
extern crate rustuv; | |
use std::io; | |
use std::os; | |
use std::io::{Listener,Acceptor,TcpStream}; | |
#[start] |
OlderNewer