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
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 <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
#!/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
#!/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 | |
# ------------------------------------------------------------ |
NewerOlder