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/bash | |
# ------------------------------------------------------------ | |
# Reconfiguare all *.deb installed packages | |
# Run dpkg-reconfigure for all dpkg -l | |
# | |
# USAGE insert next to terminal or run as sh script | |
# | |
# Be careful reconfiguration can broke your system | |
# ------------------------------------------------------------ |
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/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 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/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 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 <random> | |
template<typename T> | |
class RandomWrapper | |
{ | |
public: | |
RandomWrapper() : data(dist(rng)) { | |
} | |
operator T() { return data; } | |
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
long NUP2(long x) { | |
x--; | |
for (int p=1; p<32; p<<=1) x |= (x >> p); | |
return ++x; | |
} |
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 <cstring> | |
#include <cstdio> | |
void dump_bytes(const unsigned char * data, int len, char *outBuf) { | |
sprintf(outBuf, "%d bytes:\n", len); | |
char * tmp=outBuf + strlen(outBuf); | |
for (int j=0; j<len; j++) { | |
if (j % 16 == 0) { | |
sprintf(tmp, "%04X:", j); | |
tmp+=5; |
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
// 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 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<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 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/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" |
OlderNewer