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
# -*- mode: org -*- | |
#+OPTIONS: reveal_center:t reveal_progress:t reveal_history:t reveal_control:t | |
#+OPTIONS: reveal_mathjax:t reveal_rolling_links:nil reveal_keyboard:t reveal_overview:t num:nil | |
#+OPTIONS: reveal_width:1600 reveal_height:900 | |
#+OPTIONS: toc:nil ^:nil <:nil timestamp:nil email:t reveal_slide_number:"c/t" | |
#+REVEAL_MARGIN: 0.1 | |
#+REVEAL_MIN_SCALE: 0.5 | |
#+REVEAL_MAX_SCALE: 2.5 | |
#+REVEAL_TRANS: none | |
#+REVEAL_THEME: blood |
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
{ | |
# fields between ( and ) | |
start = index($0, "(") + 1 | |
len = index($0, ")") - start | |
$0 = substr($0, start, len) | |
# field n-2 is the timestamp | |
line_age = systime() - $(NF - 2) | |
# fields before timestamp are author | |
author = $1 |
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 <iostream> | |
#include <string> | |
#include <vector> | |
template <uint32_t N> | |
struct request; | |
template <> | |
struct request<0> | |
{ |
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 <algorithm> | |
#include <iostream> | |
#include <type_traits> | |
class CIString { | |
std::string s; | |
public: | |
CIString(std::string _s): s(_s) {}; |
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 <algorithm> | |
#include <cassert> | |
#include <iostream> | |
#include <memory> | |
#include <utility> | |
using namespace std; | |
struct Foo | |
{ |
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
#pragma once | |
#include <type_traits> | |
#include <utility> | |
#if __cplusplus >= 201703L | |
// C++17 has variadic using | |
template <typename... Fs> |
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
// 2017 Pi Day challenge: | |
// http://www.fluentcpp.com/2017/03/02/the-pi-day-challenge-for-expressive-code-in-c/ | |
#include <algorithm> | |
#include <array> | |
#include <cmath> | |
#include <functional> | |
#include <iomanip> | |
#include <iostream> | |
#include <random> |
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
constexpr uint64_t lo(uint64_t x) { return x & UINT64_C(0xffffffff); } | |
constexpr uint64_t hi(uint64_t x) { return x >> 32; } | |
constexpr uint64_t mulu64(uint64_t a, uint64_t b) | |
{ | |
return lo(lo(a) * lo(b)) | |
+ (lo(hi(lo(a) * lo(b)) | |
+ lo(a) * hi(b) | |
+ hi(a) * lo(b)) << 32); | |
} |
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 <cstddef> | |
#include <iostream> | |
#include <type_traits> | |
#include <utility> | |
using namespace std; | |
template <typename T, T Start, T... Ts> | |
const auto& make_int_range_helper(std::integer_sequence<T, Ts...>) { | |
static const initializer_list<int> il{ (Start+Ts)...}; |
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 <algorithm> | |
#include <array> | |
#include <chrono> | |
#include <functional> | |
#include <iostream> | |
#include <iterator> | |
#include <limits> | |
#include <random> | |
#include <type_traits> |
NewerOlder