Skip to content

Instantly share code, notes, and snippets.

@jgillis
jgillis / sympy2casadi
Last active March 23, 2024 21:49
Convert sympy expression to CasADi
def sympy2casadi(sympy_expr,sympy_var,casadi_var):
import casadi
assert casadi_var.is_vector()
if casadi_var.shape[1]>1:
casadi_var = casadi_var.T
casadi_var = casadi.vertsplit(casadi_var)
from sympy.utilities.lambdify import lambdify
mapping = {'ImmutableDenseMatrix': casadi.blockcat,
'MutableDenseMatrix': casadi.blockcat,
@mbinna
mbinna / effective_modern_cmake.md
Last active April 18, 2024 19:26
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

@gocarlos
gocarlos / Eigen Cheat sheet
Last active February 11, 2024 14:07
Cheat sheet for the linear algebra library Eigen: http://eigen.tuxfamily.org/
// 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.
@nschloe
nschloe / CMakeLists.txt
Created September 1, 2016 13:02
SWIG Python: Derive from C++ base class in Python
cmake_minimum_required(VERSION 3.0)
project(mytest)
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
@japboy
japboy / jade-ftw.md
Last active October 23, 2023 11:18
Jade について。

Jade FTW

こんにちは。今回は現実逃避を兼ねて Jade の素晴らしさをお伝えしたいと思います。

Jade とは何か

[Jade][0] は JST (JavaScript Templates) の一つであり、HTML を書くための[軽量マークアップ言語][1] である [Haml][2] に影響を受けた JavaScript テンプレートエンジンでもあります。

@dscape
dscape / The-Innovators-Dilemma-Summary.md
Created February 22, 2011 21:02
Notes on The Innovator’s Dilemma: When New Technologies Cause Great Firms to Fail

Notes on The Innovator’s Dilemma: When New Technologies Cause Great Firms to Fail

  • Book by: Clayton M. Christensen, Cambridge, Massachusetts: Harvard Business School Press, 1997
  • Prepared by: B.B. McBreen. See [PDF][1] (more readable but it's not plain text)

Summary

  1. Market progress is separate from technology progress. Customers do not always know what they need.
  2. Innovation requires resource allocation which is extraordinarily difficult for disruptive technologies.
  3. Disruptive technology needs a new market. Old customers are less relevant. Disruptive technology is a marketing problem, not a technological one.