Skip to content

Instantly share code, notes, and snippets.

View erikzenker's full-sized avatar
🤖
lost in the tunnel

Erik Zenker erikzenker

🤖
lost in the tunnel
View GitHub Profile

DIY Solar Power System

In this document I want to describe my progress building an own solar load controller.

Problem

There exist a lot of solar load controller which you can use to build a simple solar power system. Usualy, these load controller do not provide open and well documented interfaces to access data such as:

  • Solar panel voltage/current
  • Battery voltage
  • Consumer current

Clang Compile Time Cookbook

In this cookbook I will discuss several techniques to reduce the compile time of the llvm frontend clang. I will put the focus on heavy template and constexpr code.

Clang Tools Pipeline

First it is important to understand the internals of clang. Clang is a collection of tools which are pipelined.

Preprocessor

  • Performs the actions of the C preprocessor
  • The command line option -E stops clang after this stage
@erikzenker
erikzenker / boost_hana_cookbook.md
Last active July 1, 2021 18:31
Boost Hana Cookbook

Boost Hana Cookbook

All receipies use the following include and namespace:

#include <boost/hana.hpp>
namespace bh = boost::hana;

Best Practice

  • use make_basic_tuple over make_tuple since a basic_tuple is more compile time efficient.
@erikzenker
erikzenker / meta_class_cookbook.cpp
Created October 3, 2018 18:30
C++ MetaClass CookBook
// API Documentation was created based on the presentation of Herb Sutter on CppCon 2018:
// https://www.youtube.com/watch?v=80BZxujhY38
// and the original propsal:
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0707r3.pdf
// and test from the implementation repo
// https://github.com/asutton/clang/tree/095a810d0514ccc9b3ea66c546a2adc7384449ca/test/CXX/meta
// Create a meta class
template <typename T>
constexpr void meta_class(T source){
@erikzenker
erikzenker / AwesomeGestures.md
Last active March 19, 2024 20:42
OSX like gesture for arch linux onn awesome windowmanager

This is a manual for OSX like touchpad gestures on arch linux for the awesome window manager. It describes how to trigger awesome actions on swiping with three fingers on the touchpad.

  • Install libinput dependencies pacaur -S sf86-input-libinput libinput-gestures

  • Add current user to input group sudo gpasswd -a $USER input

@erikzenker
erikzenker / nix-profile.sh
Created April 14, 2017 13:54 — forked from benley/nix-profile.sh
tweaked nix login script
# Heavily cribbed from the equivalent NixOS login script.
# This should work better with multi-user nix setups.
export NIXPKGS_CONFIG="/etc/nix/nixpkgs-config.nix"
export NIX_OTHER_STORES="/run/nix/remote-stores/*/nix"
export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
export NIX_PROFILES="/nix/var/nix/profiles/default $HOME/.nix-profile"
export NIX_PATH="/nix/var/nix/profiles/per-user/root/channels"
export PATH="$HOME/.nix-profile/bin:$HOME/.nix-profile/sbin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:$PATH"
#! /usr/bin/env sh
# Init paths
cd ~
mkdir -p projects
cd projects
# Load modules
module load git
module load intel/2016.2.181
#!/usr/bin/env sh
# Create paths
cd ~
mkdir projects
cd projects
# Load modules
module purge
module load gcc/4.9.2
@erikzenker
erikzenker / Build for xeon phi on taurus
Last active May 20, 2016 13:30
Build for xeon phi on taurus
#! /usr/bin/env sh
# Intel tutorial: https://software.intel.com/en-us/articles/building-a-native-application-for-intel-xeon-phi-coprocessors
# Load modules
module load intel/2016.2.181
module load cmake/3.3.1
module load boost/1.60.0-intel2016.2.181-intelmpi5.1-knc
module load gcc/4.9.3 # gives hints to icc where to find libstdc++
# Load some magic numbers
#!/usr/bin/env sh
git clone https://github.com/psychocoderHPC/picongpu-alpaka.git
cd picongpu-alpaka
git checkout topic-cupla
cd ..
git clone https://github.com/psychocoderHPC/alpaka.git
cd alpaka
git checkout topic-picongpu-alpaka