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
| /** files modifications monitoring via inotify | |
| Attention: inotify monitoring of a file have some problems. | |
| E.g. some editors rm then creates files with sthe same name when editing. | |
| So, it's a more robust to monitor entire dir | |
| */ | |
| #include <iostream> | |
| #include <string> | |
| #include <functional> | |
| #include <stdexcept> |
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
| //ldflags="-lboost_filesystem -lboost_system" | |
| #include <iostream> | |
| #include <locale> | |
| #include <fstream> | |
| #include <string> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <boost/utility/string_ref.hpp> | |
| #include <boost/filesystem.hpp> | |
| #include <boost/algorithm/string.hpp> |
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/env python | |
| # -*- coding: utf-8 -*- | |
| """ задачка """ | |
| a = [1,2,3] | |
| def aggregator(accum, item): | |
| """ пример ф-ции 'аккумулятора' для обработки части данных в распределённом фрейморке |
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 | |
| """ | |
| Pagination model for sorted docs collection, that is periodically updated. | |
| The key ideas: | |
| - all docs have sequential id | |
| - docs are sorted by composite key (weight, sequential id) | |
| - response to page request containse 'next_offset' (a composite key) that should be used to get next page | |
| """ |
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
| from types import NoneType | |
| class Field(object): | |
| def __init__(self, expected_types, *default): | |
| self.name = None # set by metaclass | |
| self.internal_name = None # set by metaclass | |
| self.expected_types = expected_types | |
| if default: | |
| self.default = default[0] |
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
| -- partition by month | |
| -- https://www.postgresql.org/docs/9.5/static/ddl-partitioning.html | |
| begin; | |
| drop trigger if exists insert_master_trigger on master; | |
| drop function if exists master_insert(); | |
| drop table if exists master cascade; | |
| create table master( | |
| id bigserial primary 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
| -- partition by month | |
| -- https://www.postgresql.org/docs/9.5/static/ddl-partitioning.html | |
| begin; | |
| drop trigger if exists insert_master_trigger on master; | |
| drop function if exists master_insert(); | |
| drop table if exists master cascade; | |
| create table master( | |
| id bigserial primary 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
| #include <unicode/translit.h> | |
| class TranslitConverter | |
| { | |
| static const UnicodeString TRANSLITERATION_RULES; | |
| public: | |
| TranslitConverter() | |
| { | |
| UErrorCode status = U_ZERO_ERROR; |
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
| LOCATIONS = """ | |
| country | |
| UK | |
| city | |
| London | |
| Guildford | |
| county | |
| Surray | |
| Sussex | |
| Belgium |
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
| package main | |
| import ( | |
| "encoding/json" | |
| "errors" | |
| "fmt" | |
| "github.com/go-redis/redis" | |
| "log" | |
| "reflect" | |
| ) |