Skip to content

Instantly share code, notes, and snippets.

View pkestene's full-sized avatar

Pierre Kestener pkestene

View GitHub Profile
@pkestene
pkestene / p4est.cmake
Created April 22, 2023 09:19
p4est cmake detection
# let say we require to use at least p4est version 2.8.5
set(P4EST_MINIMAL_VERSION 2.8.5)
# first try to detect P4ESTConfig.cmake somewhere in the CMAKE_PREFIX_PATH
# if found, we're ready to go using target P4EST::P4EST
find_package(P4EST ${P4EST_MINIMAL_VERSION} CONFIG QUIET)
if(P4EST_FOUND)
message(STATUS "P4EST was found with find_package, with version ${P4EST_VERSION}")
endif()

Since version 2.23, git-blame has a feature to ignore certain commits. This feature is useful to ignore large formatting or apparently unimportant changes.

How to use

  1. Create a revisions list file. The file name is usually .git-blame-ignore-revs
  2. Set the file as a default ignore file for blame by git config blame.ignoreRevsFile .git-blame-ignore-revs

The file format is described in git-fsck's man: https://git-scm.com/docs/git-fsck#Documentation/git-fsck.txt-fsckskipList

@Wumpf
Wumpf / cfd.md
Last active September 22, 2024 03:22
Notes on CFD
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active November 8, 2024 20:02
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@mbinna
mbinna / effective_modern_cmake.md
Last active November 13, 2024 23:24
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@wagoodman
wagoodman / sexy-minimal.bash
Created June 29, 2017 00:13
Sexy Minimal Bash Prompt theme for bash-it
# Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt"
# Screenshot: http://cloud.gf3.ca/M5rG
# A big thanks to \amethyst on Freenode
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then export TERM=gnome-256color
elif [[ $TERM != dumb ]] && infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color
fi
if tput setaf 1 &> /dev/null; then
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
@scchan
scchan / saxpy.cpp
Last active October 12, 2018 16:11
hcc saxpy example
#include <random>
#include <algorithm>
#include <iostream>
#include <cmath>
// header file for the hc API
#include <hc.hpp>
#define N (1024 * 500)
@vhodges
vhodges / metropolis.css
Last active December 18, 2023 05:33
A version of the Beamer theme Metropolis for reveal.js
/**
* A simple theme for reveal.js presentations, derived from serif.css
* It's in the spirit of the Metropolis theme for beamer https://github.com/matze/mtheme
*
* This theme is Copyright (C) 2016 Vince Hodges, http://sourdoughlabs.com - it is MIT licensed.
*/
@import url('https://fonts.googleapis.com/css?family=Fira+Sans');
.reveal a {
@ldionne
ldionne / static_map.cpp
Last active August 8, 2023 10:17
Toy implementation of a static constexpr map
#include <algorithm>
#include <array>
#include <cassert>
#include <experimental/string_view>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <utility>
@ax3l
ax3l / CUDA_Compilers.md
Last active November 4, 2024 08:04
CUDA Compilers