Skip to content

Instantly share code, notes, and snippets.

View seriyps's full-sized avatar

Sergey Prokhorov seriyps

View GitHub Profile
@seriyps
seriyps / decode_wordstat.erl
Created August 7, 2013 15:49
Yandex wordstat encrypted AJAX decoder for Python and Erlang
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),
@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.
'''
@seriyps
seriyps / erlydtl_xgettext.erl
Last active August 29, 2015 14:01
.po file generator from erlydtl templates
%% 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).
@seriyps
seriyps / microlisp.py
Created April 11, 2014 14:00
Lisp subset interpreter
# -*- coding: utf-8 -*-
'''
Created on 2014-04-05
@author: Sergey Prokhorov <me@seriyps.ru>
'''
import re
import operator
import decimal