Skip to content

Instantly share code, notes, and snippets.

View tienviitta's full-sized avatar

Petri Väisänen tienviitta

  • Tienviitta
  • Kempele, Finland
View GitHub Profile
@mofosyne
mofosyne / circularBuffer_uint8.h
Last active June 12, 2023 16:00
Circular Byte Buffer For Embedded Applications (Index Based)
// # Circular Byte Buffer For Embedded Applications (Index Based)
// Author: Brian Khuu (July 2020) (briankhuu.com) ([email protected])
// Reason: Malloc free, minimum overhead implementation of a circular buffer.
// Static inlined handlers for speed and ease of usage in various projects.
// Index based implementation diverges from harshkn's version, since it is
// easier for me to grok. However may come at cost of speed and optimisation.
// Also uses byte based rather than item based for easier understability
// when used for simpler byte array circular buffers.
// I have also written an pointer based circular buffer version.
// Based on harshkn's circular buffer: https://gist.github.com/harshkn/909546
@mbinna
mbinna / effective_modern_cmake.md
Last active April 17, 2025 03:18
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

@phg1024
phg1024 / eigen_matlab.cpp
Created October 28, 2015 00:12
Eigen-MATLAB reference
// A simple quickref for Eigen. Add anything that's missing.
// Main author: Keir Mierle
#include <Eigen/Dense>
Matrix<double, 3, 3> A; // Fixed rows and cols. Same as Matrix3d.
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
Matrix<double, 3, 3, RowMajor> E; // Row major; default is column-major.
Matrix3f P, Q, R; // 3x3 float matrix.