Skip to content

Instantly share code, notes, and snippets.

View netcan's full-sized avatar

Netcan netcan

View GitHub Profile
@GuillaumeDua
GuillaumeDua / Concept-based polymorphism in modern Cpp.md
Last active May 4, 2024 09:30
Concept-based polymorphism in modern C++

Concept-based polymorphism in modern C++

Date 05-05-2021 - 10-17-2023
Revision R3
Author Guillaume Dua
Reviewers Loïc Joly, Antoine Morrier
@davesilva
davesilva / kvm-bridge-networking-on-debian-buster.md
Last active March 8, 2023 14:41
Bridge networking for KVM on Debian Buster

Step 1: Create bridge network

Edit /etc/network/interfaces

# Set up physical ethernet interface (enp4s0) to not use DHCP
iface enp4s0 inet manual
iface enp4s0 inet6 manual

# Set up bridge interface to use DHCP instead
@Som1Lse
Som1Lse / is_constant_evaluated.md
Last active October 11, 2023 17:04
The confusion with `std::is_constant_evaluated`, hopefully cleared up

The confusion with std::is_constant_evaluated, hopefully cleared up

Disclaimer: I am not on the committee, and while I have done my due diligence, I could easily have missed something. This is also not an attack on anyone. As stated the confusion is quite understandable, and the talk mentioned generally does a good job of introducing some small features of C++20, even if it does contain a minor mistake.

Introduction

This is inspired by Timur Doumler's C++20: The small things given at CppCon 2019 where, at 48:00, somebody points out a mistake on

@chrisdone
chrisdone / gist:02e165a0004be33734ac2334f215380e
Last active May 26, 2024 13:57
Build and run minimal Linux / Busybox systems in Qemu

Common

export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS

Linux kernel

@mbinna
mbinna / effective_modern_cmake.md
Last active May 31, 2024 16:02
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

@matthewhartman
matthewhartman / install-fonts.txt
Created March 1, 2015 11:27
Install TTF Fonts in Debian
cd fonts
mv *.ttf /usr/share/fonts/truetype
cd /usr/share/fonts/truetype
mkfontscale
mkfontdir
fc-cache
xset fp rehash
@mattbierner
mattbierner / life_comonadic.cpp
Created November 3, 2014 00:25
c++ Compile Time Comonaic Life
/**
* Conway's game of life implemented in C++ templates at compile time using Comonads.
*
* Logic based on: http://blog.emillon.org/posts/2012-10-18-comonadic-life.html
*/
#include <iostream>
/// Identity functor
template <typename X>
struct id {
@mattbierner
mattbierner / gist:090a80d25259b6472827
Last active March 5, 2021 13:55
Compile Time Brainfuck C++ Metaprogramming Evaluator
#include <utility>
using iochar = char;
using memval = unsigned char;
/* BF Memory Cell */
template <memval val = 0>
struct Cell {
enum { value = val };
@benloong
benloong / functionperformance.cpp
Created December 20, 2013 03:51
c++11 direct function call, virtual function call, functor and std::function(using a lambda) performance test
#include <iostream>
#include <chrono>
#include <memory>
#include <functional>
using namespace std;
using namespace std::chrono;
class Base
{
@edokeh
edokeh / index.js
Last active May 31, 2024 06:45
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \