This file contains 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
// debug.h | |
#include <iostream> | |
#define NDEBUG 1 | |
#ifdef NDEBUG | |
#define debug if(1); else std::cout | |
#else | |
#define debug std::cout | |
#endif | |
using namespace std; |
This file contains 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 | |
''' Async TCP server to make first tests of newly received GPS trackers ''' | |
import asyncore | |
import socket | |
import logging | |
class Server(asyncore.dispatcher): | |
def __init__(self, address): | |
asyncore.dispatcher.__init__(self) |
This file contains 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
//------------------------------------------------------------------------------ | |
// C++ module xxx.h, xxx.cpp | |
//------------------------------------------------------------------------------ | |
#include <string> | |
#include <boost/regex.hpp> | |
#include <boost/locale.hpp> | |
#include <boost/foreach.hpp> | |
#include <boost/algorithm/string.hpp> | |
class PhoneExtractor |
This file contains 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; | |
This file contains 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 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 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 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 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 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: |
OlderNewer