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
cd /root | |
aptitude install curl git | |
git clone https://github.com/ned14/mailinabox.git | |
cd mailinabox | |
DISABLE_FIREWALL=1 setup/start.sh | |
(Use usual@nedprod.com for the email and mail.nedprod.com for the server) | |
cd /home/user-data/ssl/nedprod.com | |
nano private_key.pem | |
(Use nedprod.com cert private key) | |
chmod og-rwx private_key.pem |
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 <stdio.h> | |
#include <type_traits> | |
#define BOOST_CXX14_CONSTEXPR constexpr | |
template<class Enum> struct bitfield : public Enum | |
{ | |
using enum_type = typename Enum::enum_type; | |
using underlying_type = std::underlying_type_t<enum_type>; | |
private: |
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 <stdio.h> | |
#define BOOST_CXX14_CONSTEXPR constexpr | |
//! Constexpr bitwise flags support | |
template<class Derived, class T = unsigned> class bitwise_flags | |
{ | |
T _value; | |
public: | |
//! The underlying type |
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 <stdio.h> | |
#define BOOST_AFIO_DECLARE_CLASS_ENUM_AS_BITFIELD(type) \ | |
inline constexpr type operator&(type a, type b) \ | |
{ \ | |
return static_cast<type>(static_cast<size_t>(a) & static_cast<size_t>(b)); \ | |
} \ | |
inline constexpr type operator&=(type a, type b) \ | |
{ \ | |
return static_cast<type>(static_cast<size_t>(a) & static_cast<size_t>(b)); \ |
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 <vector> | |
#include <future> | |
#include <filesystem> | |
using std::future; | |
namespace filesystem = std::experimental::filesystem; | |
class data_store | |
{ | |
public: | |
//! Disposition flags |
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
// Set a dispatcher as current for this thread | |
afio::current_dispatcher_guard h(afio::make_dispatcher().get()); | |
// Config a write gather | |
std::vector<asio::const_buffer> buffers; | |
buffers.push_back(asio::const_buffer("He", 2)); | |
buffers.push_back(asio::const_buffer("ll", 2)); | |
buffers.push_back(asio::const_buffer("o ", 2)); | |
buffers.push_back(asio::const_buffer("Wo", 2)); |
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
// Set a dispatcher as current for this thread | |
afio::current_dispatcher_guard h(afio::make_dispatcher().get()); | |
// Config a write gather | |
std::vector<asio::const_buffer> buffers; | |
buffers.push_back(asio::const_buffer("He", 2)); | |
buffers.push_back(asio::const_buffer("ll", 2)); | |
buffers.push_back(asio::const_buffer("o ", 2)); | |
buffers.push_back(asio::const_buffer("Wo", 2)); |
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
/* hamming_test.cpp | |
Test generic hamming coding routines (SECDEC). These can fix 1 bit errors and detect two bit errors. | |
(C) 2015 Niall Douglas http://www.nedprod.com | |
g++ -std=c++11 -o hamming_test -O3 -fverbose-asm -Wa,-adhln hamming_test.cpp -march=ivybridge > hamming_test.S | |
On my 3.9Ghz Ivy Bridge Intel 3770K: | |
For no intrinsics: | |
Calculating 4Kb: 12.06Mb/sec |
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
/* hamming_test.cpp | |
Test generic hamming coding routines (SECDEC). These can fix 1 bit errors and detect two bit errors. | |
(C) 2015 Niall Douglas http://www.nedprod.com | |
On my 3.9Ghz Ivy Bridge Intel 3770K: | |
For no intrinsics: | |
Calculating 4Kb: 12.06Mb/sec | |
Fixing 4Kb: 14.98Mb/sec |