Skip to content

Instantly share code, notes, and snippets.

#include <boost/callable_traits.hpp>
#include <fmt/format.h>
#include <tuple>
void increment_int(int a) { fmt::print("{}\n", a + 1); }
void increment_double(double a) { fmt::print("{}\n", std::pow(a, 2)); }
void increment_both(int a, double b) {
auto ia = a + 1;
#include <boost/asio.hpp>
#include <boost/asio/bind_executor.hpp>
#include <boost/asio/spawn.hpp>
#include <boost/bind.hpp>
#include <chrono>
#include <random>
#include <spdlog/spdlog.h>
#include <thread>
int32_t next_int() {
@AndrewRademacher
AndrewRademacher / main.cpp
Created May 5, 2019 17:51
testing for proximity to end of iterator in all cases except input iterator.
#include <string>
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <unordered_set>
template<typename T>
void printElems(T elems) {
std::cout << "[ ";
@AndrewRademacher
AndrewRademacher / main.cpp
Created May 5, 2019 17:46
testing generically for proximity to the end of a structure.
#include <string>
#include <iostream>
#include <vector>
#include <array>
template<typename T>
void printElemes(T elems) {
std::cout << "[ ";
for (auto itr = elems.begin(); itr != elems.end(); ++itr) {
std::cout << *itr;
@AndrewRademacher
AndrewRademacher / main.cpp
Created May 5, 2019 17:40
testing for proximity to the end of an iterator.
#include <string>
#include <iostream>
#include <vector>
int main() {
std::vector<uint64_t> elems{1, 2, 3, 4, 5, 6};
// print
std::cout << "[ ";
for (auto itr = elems.begin(); itr != elems.end(); ++itr) {

Keybase proof

I hereby claim:

  • I am AndrewRademacher on github.
  • I am andrewrademacher (https://keybase.io/andrewrademacher) on keybase.
  • I have a public key whose fingerprint is 9EEC 1A26 D1B2 07DD C6FA 09E2 024C E77E B451 BB0E

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am AndrewRademacher on github.
  • I am andrewrademacher (https://keybase.io/andrewrademacher) on keybase.
  • I have a public key whose fingerprint is CCD0 5E6C F24A 9427 918F A0A5 2347 5621 352E C82B

To claim this, I am signing this object:

#include <iostream>
#include <stdio.h>
using namespace std;
int sumArray(int inputArray[], int arrayCount) {
if (arrayCount == 1) {
return inputArray[0];
}
.section __TEXT,__text,regular,pure_instructions
.macosx_version_min 10, 10
.globl __Z8sumArrayPii
.align 4, 0x90
__Z8sumArrayPii: ## @_Z8sumArrayPii
.cfi_startproc
## BB#0:
push rbp
Ltmp0:
.cfi_def_cfa_offset 16
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
import Control.Lens
import Control.Monad
import Data.Data
import Data.Text (Text)
import Data.Word
import GHC.Generics
import System.Console.CmdLib