Skip to content

Instantly share code, notes, and snippets.

@parsa
parsa / .gitignore
Last active October 31, 2017 18:53
project/
blaze/
cmake_minimum_required(VERSION 3.8)
project(foo CXX)
find_package(LAPACK REQUIRED)
message("LAPACK_FOUND=${LAPACK_FOUND}")
message("LAPACK_LIBRARIES=${LAPACK_LIBRARIES}")
@parsa
parsa / Rebuilding glibc 2.3.x.md
Last active December 5, 2017 05:05
Rebuilding glibc 2.3.x (more commonly known as "Playing with Fire")

From: http://oregontechsupport.com/articles/glibc.php

Rebuilding glibc 2.3.x (more commonly known as "Playing with Fire")

"Don't get suckered in by the comments -- they can be terribly misleading. Debug only code." -- Dave Storer

The GNU C Library (glibc) is more or less a collection of commonly used C-programming libraries. Many essential programs require these routines; in addition, you won't be able to compile any programs without it.

Disclaimer/Warning

@parsa
parsa / fib_test.cpp
Last active February 7, 2018 20:36 — forked from shahrzad/fib_test
// Copyright (c) 2018 Shahrzad Shirzad
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <phylanx/phylanx.hpp>
#include <hpx/hpx_main.hpp>
#include <iostream>
auto f = [](auto it)->hpx::future<int>& { return it->second; };
hpx::wait_all(
hpx::util::make_transform_iterator(items.begin(), f),
hpx::util::make_transform_iterator(items.end(), f));
@parsa
parsa / prog.cpp
Created February 19, 2018 19:45
Constructors Demo
#include <iostream>
struct A
{
//A() = delete;
A()
{
std::cout << "A::A()\n";
}
A(int)
@parsa
parsa / human_readable_types.cpp
Last active February 19, 2018 22:12
Human Readable Type Names with Boost.TypeIndex
#include <iostream>
#include <boost/type_index.hpp>
struct A {};
template <typename T>
void f(T&& t)
{
std::cout << boost::typeindex::type_id_with_cvr<decltype(t)>().pretty_name() << '\n';
}
@parsa
parsa / move_semantics.cpp
Created February 20, 2018 16:36
Move Semantics Demo
#include <utility>
struct A {};
struct B {};
void f(B&& b) {} // rvalue ref
void f(B const& b) {} // const lvalue ref
void f1(B b) {}
@parsa
parsa / time_random_generators.cpp
Last active February 21, 2018 06:38
Crudely Measure Execution Time of PRNGs in <random>
#include <iostream>
#include <random>
#include <chrono>
#include <array>
#include <functional>
#include <algorithm>
struct scoped_timer
{
scoped_timer(std::string name)
hpx::util::optional<int> x;
int z = 1.;
x = z; // Fails
x = std::move(z) // Works
// hpx\hpx\util\optional.hpp(254): error C2660: 'hpx::util::optional<double>::swap': function does not take 2 arguments
// hpx\hpx\util\optional.hpp(151): note: while compiling class template member function 'hpx::util::optional<double> &hpx::util::optional<double>::operator =(const T &)'