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/bash | |
# ------------------------------------------------------------ | |
# Centos7 VirtualBox Guest Additions installation | |
# Update kernel headers and install requirements for it | |
# | |
# USAGE sudo prepare.sh | |
# | |
# sudo requires for installation, export KERNEL_DIR and reboot | |
# ------------------------------------------------------------ |
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/bash | |
# ------------------------------------------------------------ | |
# Recursive cpp code formatter based on clang-format | |
# For base work there is you need to have .clang-format file | |
# | |
# USAGE code_format.sh [clang-format-options] [<file|dir> ...] | |
# | |
# clang-format-options passes through to clang-format | |
# ------------------------------------------------------------ |
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 <random> | |
template<typename T> | |
class RandomWrapper | |
{ | |
public: | |
RandomWrapper() : data(dist(rng)) { | |
} | |
operator T() { return data; } | |
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
long NUP2(long x) { | |
x--; | |
for (int p=1; p<32; p<<=1) x |= (x >> p); | |
return ++x; | |
} |
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<string> | |
#include<iostream> | |
class ScopePrinter { | |
public: | |
template<typename STR> | |
explicit ScopePrinter(STR&& init, std::ostream& stream = std::cout) | |
: stream(stream), | |
msg(std::forward<STR>(init)) { | |
msg.append(":\t"); |
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
// determining array size | |
template <typename T, auto N> | |
char (&ArraySizeHelper(T (&array)[N]))[N]; | |
#define arraysize(array) (sizeof(ArraySizeHelper(array))) | |
// convert defined value to string | |
#define expect(expr) if(!expr) cerr << "Assertion " << #expr \ | |
" failed at " << __FILE__ << ":" << __LINE__ << endl; | |
#define stringify(x) #x |
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/bash | |
# | |
# This is workaround for faster CLion file transfer in context of remote host | |
# | |
excludes=() | |
[[ $PWD =~ cmake-build- ]] && excludes=('--exclude=*.o' '--exclude=./bin' '--exclude=./lib') | |
first="$1" |
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
// | |
// Created by imelker on 23.09.2020. | |
// | |
#ifndef OBJECTCOUNTER_H_ | |
#define OBJECTCOUNTER_H_ | |
#include <cstdio> | |
#define USE_COUNTER |
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 <chrono> | |
#include <iomanip> | |
template <typename Clock> | |
class CurrentTime | |
{ | |
template<struct tm* represent(const time_t *)> | |
static std::string utc() { | |
using namespace std::chrono; | |
auto timer = Clock::to_time_t(Clock::now()); |
OlderNewer