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 <iterator> | |
#include <numeric> | |
class array{ | |
int d[5] = { 1, 2, 3, 4, 5 }; | |
public: | |
struct it{ | |
// traits section |
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/sh | |
redirect() | |
{ | |
OP=$1 | |
NETDEV=$2 | |
S_ADDR=$3 | |
S_PORT=$4 | |
D_ADDR=$5 | |
D_PORT=$6 |
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
// gcc -O3 -std=c++17 -fconcepts | |
template<typename T> | |
concept bool EqualityComparable = requires(T a, T b) { | |
{ a == b } -> bool; | |
{ a != b } -> bool; | |
}; |
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
#define fip0 1.618 | |
#define fim0 -1.618 | |
#define fip1 0.618 | |
#define fim1 -0.618 | |
#define sqrtp1 0.7071 | |
#define sqrtm1 -0.7071 | |
rule tetrahedron { | |
{ x +1 y 0 z sqrtm1 } box |
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 "matrix.h" | |
#include <iostream> | |
int main(){ | |
constexpr Matrix<int, 2> a{ 1, 2 }; | |
constexpr Matrix<int, 2, 3> b{ | |
1, 2, | |
3, 4, |
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 <cstdint> | |
namespace mybits{ | |
constexpr uint8_t log2(uint64_t n){ | |
constexpr uint8_t tab64[64] = { | |
0, 58, 1, 59, 47, 53, 2, 60, | |
39, 48, 27, 54, 33, 42, 3, 61, | |
51, 37, 40, 49, 18, 28, 20, 55, | |
30, 34, 11, 43, 14, 22, 4, 62, |
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 <cstdio> | |
// ========================================== | |
template<class T> | |
struct VTableFor; | |
// ========================================== | |
struct Vehicle{ |
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
#ifndef MY_NARROW_H_ | |
#define MY_NARROW_H_ | |
#include <utility> // is_arithmetic | |
#include <typeinfo> // bad_cast | |
#include <limits> // numeric_limits | |
template<class T, class U> | |
constexpr T narrow(U const u){ | |
static_assert(std::is_arithmetic<T>::value, "T must be integral"); |
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 <iosfwd> | |
#include <utility> // std::forward | |
template<typename T, class TAG> | |
class StrongTypedef{ | |
private: | |
using ST = StrongTypedef; | |
T v; |
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
<? | |
class BitcoindRPC{ | |
private $url; | |
private $user; | |
private $pass; | |
function __construct($url, $user, $pass){ | |
$this->url = $url; | |
$this->user = $user; |