Skip to content

Instantly share code, notes, and snippets.

@XanderBordeaux
XanderBordeaux / boost_log_example.cpp
Created October 21, 2021 11:25 — forked from silgon/boost_log_example.cpp
Boost Log example with channel and file generation.
// compile with
// g++ -std=c++11 test_log_default.cpp -DBOOST_LOG_DYN_LINK -lboost_log -lboost_thread -lpthread -lboost_system
#include <iostream>
#include <boost/log/expressions.hpp>
#include <boost/log/sources/severity_channel_logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/utility/setup/console.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/sinks.hpp>
@XanderBordeaux
XanderBordeaux / create_vm.sh
Created October 29, 2019 08:58 — forked from sickbock/create_vm.sh
VirtualBox PXE boot
#!/bin/bash
cd ${myVMs}
MyVM=testvm
vboxmanage unregistervm ${MyVM} --delete
rm -rf ${MyVM}
mkdir ${MyVM}
cd ${MyVM}
vboxmanage createhd --filename ${MyVM}.vdi --size 30720
vboxmanage createvm --name ${MyVM} --ostype RedHat_64 --register
vboxmanage modifyvm ${MyVM} --memory 6172 --vram=12 --acpi on --nic1 NAT # optional second NIC # --nic2 bridged --bridgeadapter2 enp0s25
@XanderBordeaux
XanderBordeaux / utility.hpp
Created February 12, 2019 09:08 — forked from Apjue/utility.hpp
C++11 simple non-RTTI variant
#include <type_traits>
template <typename...>
struct IsOneOf
{
static constexpr bool value = false;
};
template <typename T, typename S, typename... Ts>
struct IsOneOf<T, S, Ts...>
@XanderBordeaux
XanderBordeaux / gist:cb34f9e19b1cef87f7ac570da41e0d7b
Created August 3, 2018 12:14 — forked from craigminihan/gist:b23c06afd9073ec32e0c
Build GCC 4.9.2 for C/C++ on CentOS 7
sudo yum install libmpc-devel mpfr-devel gmp-devel
cd ~/Downloads
curl ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2 -O
tar xvfj gcc-4.9.2.tar.bz2
cd gcc-4.9.2
./configure --disable-multilib --enable-languages=c,c++
make -j 4
make install
@XanderBordeaux
XanderBordeaux / README.md
Created July 4, 2018 08:42 — forked from magnetikonline/README.md
Bash getopt long options with values usage example.

Bash getopt long options with values usage example

#!/bin/bash -e

ARGUMENT_LIST=(
    "arg-one"
    "arg-two"
    "arg-three"
)