Skip to content

Instantly share code, notes, and snippets.

View seriyps's full-sized avatar

Sergey Prokhorov seriyps

View GitHub Profile
@seriyps
seriyps / walker_alias.erl
Last active February 15, 2022 14:07
Walker alias method implemented in Erlang
%%% @author Sergey Prokhorov <me@seriyps.ru>
%%% @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),
@seriyps
seriyps / tornado_shortgen.py
Created October 7, 2012 18:48
AST transformation for tornado.gen.Task
# -*- coding: utf-8 -*-
'''
Created on 2012-10-07
@author: Sergey <me@seriyps.ru>
Альтернативный вариант решения из статьи http://habrahabr.ru/post/153595/
на базе модификации AST
@asynchronous
@seriyps
seriyps / server.py
Created September 24, 2012 01:16
TornadoWEB streaming file server
# -*- coding: utf-8 -*-
'''
Created on 2012-09-24
@author: Sergey <me@seriyps.ru>
How to test:
$ head -c 100M /dev/urandom > static_file.bin
$ python
@seriyps
seriyps / l2tp-downloader.py
Last active October 6, 2015 17:38
Python script, that downloads "network-manager-l2tp" packet and all its dependencies and packs them to archive.
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on 2012-06-03
@author: Sergey Prokhorov <me@seriyps.ru>
Скрипт для создания архива, содержащего все пакеты, необходимые для оффлайн
установки l2tp плагина NetworkManager на Ubuntu.
'''