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
//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
/** 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" source: http://www.lexev.org/en/2013/python-logging-every-day/ | |
Settings for root logger. | |
Log messages will be printed to console and also to log file (rotated, with | |
specified size). All log messages from used libraries will be also handled. | |
Three approaches for defining logging settings are used: |
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 -*- | |
""" Script to test WebHDFS (pyhdfs python lib) | |
2015-04-21 | |
""" | |
import argparse | |
import sys | |
import os | |
import re |
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
// cxx="g++" cxxflags="-O2" | |
/** | |
Test boost ptree perfomance. | |
2015-03-27 | |
*/ | |
#include <iostream> | |
#include <vector> |
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
#!/bin/sh | |
# style lines can be copied to Qt Creator Beautifier plugin | |
clang-format-3.5 -style='{ | |
Language: Cpp, | |
Standard: Cpp11, | |
UseTab: Never, | |
IndentWidth: 4, | |
ColumnLimit: 100, | |
AllowShortIfStatementsOnASingleLine: false, |
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
// build: g++ -std=c++11 futures_queue_test.cpp -lpthread | |
// usage (single-threaded variant): ./a.out 10 single | |
// usage (multi-threaded variant): ./a.out 10 parallel | |
#include <iostream> | |
#include <sstream> | |
#include <functional> | |
#include <algorithm> | |
#include <future> | |
#include <chrono> |
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 <iostream> | |
#include <stdexcept> | |
#include <map> | |
#include <boost/property_tree/ptree.hpp> | |
#include <boost/property_tree/xml_parser.hpp> | |
using namespace std; | |
using namespace boost::property_tree; | |
int main(int argc, char const *argv[]) |
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
/** Scope exit */ | |
template<typename Callable> | |
class ScopeExit | |
{ | |
Callable m_callable; | |
public: | |
explicit ScopeExit(Callable c) : m_callable(c) {} | |
ScopeExit(const ScopeExit&) = delete; | |