Skip to content

Instantly share code, notes, and snippets.

View hnrck's full-sized avatar
💻
I may be slow to respond.

Henrick Deschamps hnrck

💻
I may be slow to respond.
View GitHub Profile
@hnrck
hnrck / Makefile
Created January 4, 2019 11:39
OpenMP installation test file with generic Makefile
BIN?=main
CXX?=clang++
EXT?=cpp
LINKS?=
SRCS=$(shell find . -name "*."$(EXT))
DIRS=$(shell find ./* -type d)
OBJS=$(patsubst %.$(EXT),%.o,$(SRCS))
INCS=$(addprefix -I, $(DIRS))
@hnrck
hnrck / Makefile
Created January 4, 2019 12:24
Open MPI installation test file with generic Makefile
BIN?=main
OMPI_CC=clang++ mpic++
MPICXX?=mpic++
MPIRUN?=mpirun
EXT?=cpp
LINKS?=
SRCS=$(shell find . -name "*."$(EXT))
DIRS=$(shell find ./* -type d)
OBJS=$(patsubst %.$(EXT),%.o,$(SRCS))
@hnrck
hnrck / Makefile
Created January 5, 2019 12:49
Open MPI with CXX headers installation test file with generic Makefile
BIN?=main
OMPI_CC=clang++ mpic++
MPICXX?=mpic++
MPIRUN?=mpirun
EXT?=cpp
LINKS?=
NB_SLOTS?=2
SRCS=$(shell find . -name "*."$(EXT))

Keybase proof

I hereby claim:

  • I am hnrck on github.
  • I am hnrck (https://keybase.io/hnrck) on keybase.
  • I have a public key ASApSVTL9Z2LOx8U7vvFuDJXzdgu3jjR-IcDIuyHpF0rRQo

To claim this, I am signing this object:

@hnrck
hnrck / resize_launcher.sh
Created June 27, 2019 09:30
Resize the OS X launcher
#!/bin/bash
usage()
{
echo -e ""
echo -e "resize_launcher"
echo -e ""
echo -e "Change or revert the number of icons in the launcher"
echo -e ""
echo -e "Usage:"
@hnrck
hnrck / example.py
Last active June 17, 2020 10:18
Python singleton design pattern
from .singleton import Singleton
class Example(metaclass=Singleton):
"""
Example class.
"""
pass
def main():
@hnrck
hnrck / accumulate.h
Created July 13, 2020 08:30
C++20 numeric accumulate implementation
#ifndef MY_STD_ACCUMULATE_H
#define MY_STD_ACCUMULATE_H
namespace my_std {
template<class InputIt, class T, class BinaryOperation>
inline auto accumulate(InputIt first, InputIt last, T init, BinaryOperation op) -> T {
for (; first < last; ++first) {
init = op(std::move(init), *first);
}
return init;
@hnrck
hnrck / Makefile
Created July 13, 2020 09:02
C++17 thread guard implementation for RAII strategy
CXX?=g++
BIN?=main
EXT?=cpp
LINKS?=pthread
CXXSTD?=c++17
SRCS=$(shell find . -name "*."$(EXT))
DIRS=$(shell find ./* -type d)
OBJS=$(patsubst %.$(EXT),%.o,$(SRCS))
@hnrck
hnrck / containers_display.cpp
Created July 13, 2020 20:10
Different way to manipulate/display a container
#include <algorithm>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <sstream>
#include <utility>
template<class t_pair>
@hnrck
hnrck / 0_hashtable.md
Created August 11, 2020 20:23
Header only implementation of hashtable in C++20

HashTable

Header only implementation of hashtable in C++20

Summary

Members Descriptions
class HashTable hashtable data structure
class HashTable::Node hashtable node data structure