Skip to content
meinzer1899Public

About

My Linux dotfiles

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

dotfiles

My Linux dotfiles.

TODO

https://github.com/AnthonyCalandra/modern-cpp-features https://www.modernescpp.com/index.php/blog/ https://google.github.io/styleguide/cppguide.html https://github.com/cpp-best-practices/cppbestpractices https://isocpp.org/wiki/faq https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines https://learn.microsoft.com/en-us/cpp/cpp/?view=msvc-160 https://www.cppstories.com/2018/08/init-string-member/ https://clang.llvm.org/extra/clang-tidy/checks/list.html https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list https://cpppatterns.com/ https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html https://linux.die.net/man/1/gcc https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md https://stackoverflow.com/questions/5088460/flags-to-enable-thorough-and-verbose-g-warnings/9862800#9862800 https://clang.llvm.org/docs/DiagnosticsReference.html https://code-examples.net/en/tagged/c++?sort=votes https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms https://llvm.org/docs/CodingStandards.html https://cpp-optimizations.netlify.app/ https://brevzin.github.io/ https://github.com/lmapii/run-clang-tidy https://github.com/lmapii/run-clang-format https://github.com/microsoft/GSL https://github.com/rturrado/the_modern_cpp_challenge https://embeddedartistry.com/fieldatlas/design-pattern-catalogue/ https://developers.redhat.com/articles/2021/10/13/printf-style-debugging-using-gdb-part-2 https://developers.redhat.com/articles/2021/10/05/printf-style-debugging-using-gdb-part-1# https://clang.llvm.org/docs/ClangFormatStyleOptions.html https://www.w3computing.com/articles/programming-languages/cplusplus/#gsc.tab=0 lefticus/cpp_weekly#175 https://github.com/cpp-best-practices/cmake_template https://github.com/google/fuzzing https://github.com/cpp-best-practices/cmake_template/blob/main/cmake/CompilerWarnings.cmake https://github.com/intel/cicd-repo-infrastructure https://github.com/HappyCerberus/daily-bite-cpp https://www.youtube.com/playlist?list=PLvv0ScY6vfd8j-tlhYVPYgiIyXduu6m-L https://sourceware.org/gdb/current/onlinedocs/gdb.html/index.html#SEC_Contents https://tamara-schmitz-devel.de/posts/gdb-reference/ https://simplifycpp.org/articles/a0987/inheritance-in-cpp-why-it-evolved-from-a-central-oop-tool-into-a-feature-that-should-be-used-car/ https://github.com/vale-cli/vale

▶ zsh-bench
==> benchmarking login shell of user meinzer1899...
creates_tty=0
has_compsys=0
has_syntax_highlighting=0
has_autosuggestions=0
has_git_prompt=0
first_prompt_lag_ms=26.536
first_command_lag_ms=115.626
command_lag_ms=2.363
input_lag_ms=4.038
exit_time_ms=101.818

Is this fast? From https://github.com/romkatv/zsh-bench#how-fast-is-fast

latency (ms) the maximum value indistinguishable from zero
first prompt lag 50
first command lag 150
command lag 10
input lag 20

Although showing 0 for has_syntax_highlighting, has_git_prompt, has_autosuggestions, has_compsys, these are enabled.

Work Environment

Setup new machine

  1. Install git and pull dotfiles repository
  2. Setup WSL
  3. mkdir -p $HOME/.config (otherwise, .config is a symlink to $HOME/dotfiles/.config).
  4. Install zsh and zi
  5. Install stow, run cd dotfiles && stow .
  6. Install tmux

pip

apt install python3.XX-venv # (e.g. 10)

Don't upgrade system to use other python version than that available in apt. Can cause other commands (e.g. apt-get) to break.

clipboard

apt install xclip

Remap CAPSLOCK to ctrl

https://github.com/ian-howell/.dotfiles/blob/main/src/remap_capslock.sh https://askubuntu.com/questions/33774/how-do-i-remap-the-caps-lock-and-ctrl-keys#comment1154797_521734 sudo vi /etc/default/keyboard and change XKBOPTIONS="ctrl:nocaps" setxkbmap -option ctrl:nocaps

https://superuser.com/questions/949385/map-capslock-to-control-in-windows-10

VirtualBox

Update GuestAdditions after updating VirtualBox via https://help.ubuntu.com/community/VirtualBox/GuestAdditions.

sudo apt-get install virtualbox-guest-additions-iso

wsl

zsh and zi

https://github.com/zsh-users/zsh/blob/master/INSTALL

$ZPFX: https://wiki.zshell.dev/docs/guides/customization#ZPFX

Install zsh to $HOME/.zi/polaris, where no sudo is needed.

mkdir -p $HOME/.zi/polaris
./configure --prefix=$HOME/.zi/polaris

zi loader is included in dotfiles (.config/zi) Additional information https://wiki.zshell.dev/docs/getting_started/installation => loader. Don't use other installation methods using curl, because of security issues (z-shell/wiki#588).

misc

zshrcs

bash, shell

set -euo pipefail; shopt -s failglob # safe mode

To release resources, use bash exit traps. http://redsymbol.net/articles/bash-exit-traps/

git

For Ubuntu, this PPA provides the latest stable upstream Git version: https://git-scm.com/download/linux.

Add .gitconfig.local for user private global entries https://git-scm.com/docs/user-manual.html#telling-git-your-name

Add ssh key so that you can push to dotfiles repository with correct user.

In dotfiles repository, change local email to noreply email from Github (preferences, email) https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address#setting-your-email-address-for-a-single-repository

ssh keys: ~/.ssh/config specify, which key belongs to which host (https://stackoverflow.com/a/69764024)

🦎 Githooks: per-repo and shared Git hooks with version control and auto update. interactive git with the help of fzf Protect and discover secrets using Gitleaks 🔑 Command-line Git information tool

alacritty

https://github.com/alacritty/alacritty/blob/master/INSTALL.md

cargo build --release

Windows: download executable

TMUX

https://github.com/tmux/tmux/wiki/Installing#from-version-control

sh autogen.sh
./configure
make -j$(nproc) && sudo make install

tmux new -s tmux

.tmux.conf:

cargo and rust

Search rust book via cli:

https://github.com/0xhiro/thebook

fzf

To auto-accept entry on Enter when searching with CTRL-R, use fzf-accept-on-enter.diff from junegunn/fzf#477 (comment).

git apply --stat --apply ~/dotfiles/fzf-accept-on-enter.diff mv fzf-keybindings-new.zsh fzf-key-bindings.zsh

Vim Integration: https://github.com/junegunn/fzf/blob/master/README-VIM.md

docker

    # docker run not needed?
    docker run --detach -v $(pwd):$(pwd) -w $(pwd) --name <name> image:tag sleep infinity # may does not work, if ENTRYPOINT is set in Dockerfile
    docker start <name> # if container with that name already exists
    docker exec <name> command # execute command, e.g. via vim-dispatch
    docker exec -it <name> /bin/bash # attach interactively
    docker stop name # to stop

vim

Important infos about editing .vimrc: https://vi.stackexchange.com/a/7723/30978

vimrcs

lua support

apt install luaX.X libluaX.X-dev luajit
./configure --enable-luainterp=yes

devcontainer

Login to dev container via ssh; install zsh and copy dotfiles https://github.com/dpetersen/dev-container-base

linter

https://github.com/iamcco/diagnostic-languageserver/wiki/Linters All of them are configured via coc-diagnostic. Activate them by mapping the linter to the desired filetype in coc-settings.json. https://github.com/iamcco/coc-diagnostic/blob/master/src/config.ts

cmake

bash-language-server

volta install bash-language-server

vint

VimL linter https://github.com/Vimjas/vint

hadolint (Dockerfile linter)

https://github.com/hadolint/hadolint

C++ cpp

resources

blogs

Compiler warnings

Security hardening flags

HARDENING = -D_FORTIFY_SOURCE=2 \
-fstack-protector-strong \
-fPIE \
-fstack-clash-protection \
-fcf-protection

Linker hardening flags

LDFLAGS = -Wl,-z,relro \
-Wl,-z,now \
-Wl,-z,noexecstack \
-Wl,-z,separate-code \
-pie

Projects

playground

HU print chunks 0001'0203'...'0e0f

ccls languageserver

API documentation

C++ API Documentation (Doxygen / Breathe / Exhale)

  • Doxygen parses C++ source code in src/bms_monitor/cpp_api/ and generates XML
  • Breathe (Sphinx extension) reads the Doxygen XML
  • Exhale (Sphinx extension) transforms Breathe output into hierarchical reStructuredText for publishing
  • https://sphinx-needs.readthedocs.io/
  • Sphinx-Needs: Generates html, pdf etc. from reStructured text. reStructured text: simple, unobtrusive markup language

unit tests gtest googletest

Reduce execution times of unit tests:

CMake

Use install-cmake.sh from foonathan to install to /usr/local. May remove "old" cmake versions, check via which -a cmake.

https://blog.feabhas.com/category/build-systems/ with https://github.com/feabhas/cmake-presets-blog

TOP

set_compiler_flag( _cxx_std_flag CXX "-std=c++23" # this should work with GNU, Intel, PGI "/std:c++23" # this should work with MSVC )

* https://github.com/schweitzer/modern-cmake-tutorial
* debug generator expressions: https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#debugging

#### Misc

* [Macros usages in C++](https://fekir.info/post/macro-usages-in-cpp/)

[cmake4vim](https://github.com/ilyachur/cmake4vim/)
[cmake-language-server](https://github.com/regen100/cmake-language-server)

Determine the minimal required CMake version of a project: [cmake_min_version](https://github.com/nlohmann/cmake_min_version)

### Online Compiler, Online performance, Online benchmarking, Online Codebrowser

* [Code Browser for C, C++, Rust & Dart by KDAB](https://codebrowser.dev/)
* https://godbolt.org/
* https://cppinsights.io/
* https://www.perfbench.com/
* https://quick-bench.com/
* https://www.onlinegdb.com/

### Optimization, performance, profiling, dependencies, benchmarking

* [Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io](https://github.com/renovatebot/renovate)
* [Keynote: Benchmarking - It's About Time - Matt Godbolt - C++Now 2026](https://www.youtube.com/watch?v=EU_nQh8wg5A)
* [Simple, fast, accurate single-header microbenchmarking functionality for C++11/14/17/20](https://github.com/martinus/nanobench)
* https://jotavare.github.io/valgrind_cheatsheet/
* [An open-source benchmark and tracking library for C++ projects, designed to provide deep insights into
    function performance with minimal overhead.](https://github.com/Compaile/ctrack)
* https://github.com/springmeyer/profiling-guide with [perf](https://www.brendangregg.com/perf.html)
* https://ftp.gnu.org/old-gnu/Manuals/gprof-2.9.1/html_mono/gprof.html
* https://github.com/jmuehlig/perf-cpp and https://github.com/Compaile/ctrack
* https://fekir.info/post/cpp-performance-guidelines/
* https://fekir.info/post/library-dependency-graphs-in-cmake/
* https://vitaut.net/posts/2024/faster-cpp-compile-times/
* https://fekir.info/post/analyze-build-times-with-clang/
* https://fekir.info/post/analyze-configure-times-with-cmake/

### _LLVM_, `clang`, `clangd`

* https://github.com/jmpfar/clangd-wheel and https://realpython.com/python-wheels/
* https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
* https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
```cmake
message(STATUS "Address sanitizer enabled")
add_compile_options(-fsanitize=address,undefined,integer)
add_compile_options(-fsanitize=unsigned-integer-overflow)
add_compile_options(-fno-sanitize=signed-integer-overflow)
add_compile_options(-fno-sanitize-recover=all)
add_compile_options(-fno-omit-frame-pointer)
add_compile_options(-fsanitize-trap=undefined) # stop (TRAP signal) after first occurrence
add_link_options(-fsanitize=address,undefined)
add_link_options(-fuse-ld=clang++) # according to UB san documentation for clang

Installation description: https://apt.llvm.org/ -> Automatic installation script installs all llvm packages (also clangd, clang-tidy, include-cleaner etc) at /bin. Also adds apt.llvm.org to apt package list to automatically get updates. CAUTION: if there is a major version update, this gets not added automatically, because the script above adds only specified major version to apt list, e.g. https://apt.llvm.org/jammy llvm-toolchain-jammy-18 InRelease. For me using Ubuntu 22.04, I called the script again, but it installed 18, not newest 19. Section:

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
# for latest <version number> check variable CURRENT_LLVM_STABLE in llvh.sh
sudo ./llvm.sh <version number> all

needed to also install clang-tidy etc. Update alternatives with --slave like here

Need to update alternatives for llvm tools, e.g. clang-format, clangd, clang-tidy, lld.

sudo update-alternatives --install /bin/clang-format clang-format /bin/clang-format-17 20

Cache for clang-tidy static analysis results: https://github.com/matus-chochlik/ctcache/tree/main https://stackoverflow.com/questions/51582604/how-to-use-cpplint-code-style-checking-with-cmake https://github.com/lmapii/run-clang-tidy CLI application to run clang-tidy on a set of files specified using globs in a JSON configuration file. https://github.com/lljbash/clangd-tidy A faster alternative to clang-tidy https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm

GDB

https://sourceware.org/gdb/current/onlinedocs/gdb.html/index.html

:packadd termdebug
:Termdebug " help Termdebug, :Arguments <args, eg. --gtest_filter=<unquoted regex>

asynctask

dotfiles management, dotfiles

linker, wild, mold

CC="clang" CXX="clang++" LDFLAGS="{LDFLAGS} -fuse-ld=mold" cmake ...

neovim nvim

Most Beautiful Typing practice plugin for Neovim with dashboard Code Intelligence in Neovim - The LSP Setup that grants you IDE Powers | Neovim from Scratch Part 4 The Laziest Neovim (NeovimConf 2023) | Speed Up Neovim Neovim for Newbs. FREE COURSE The Only Video You Need to Get Started with Neovim The perfect Neovim setup for C++ C++ Coding with Neovim - Prateek Raman - CppCon 2022 Neovim for C++: https://www.youtube.com/watch?v=lsFoZIg-oDs

https://github.com/kristijanhusak/neovim-config

Use FZF instead of telescope

Tridactyl

:mktridactylrc => saves settings to rc (location see below)

location of tridactylrc

other

https://hackingcpp.com/dev/command_line_tools.html

https://github.com/tummychow/git-absorb

https://github.com/jarun/ddgr with https://github.com/tats/w3m/blob/master/doc/README

Whiteboards with https://tldraw.dev/. https://github.com/casey/just https://github.com/NoahTheDuke/vim-just (Plug 'NoahTheDuke/vim-just', { 'for': 'just' })

offline documentation

Second Brain, PKM, Personal Knowledge Management, Obsidian, TODO, notebook

Learning Notes

software engineering, coding, programming, computer science

software architecture, software design, API design

TOP

collaboration, code review, pull request, presentation, CI, continuous integration

Resources

Code Review

Commits

Planning, Estimating

Testing

Presentations

Spelling

CV, resume, job search

LLM

regex

security

Gear, desk, chair, computer, laptop, video

CLI, terminal, TUI

About

My Linux dotfiles

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Contributors

Languages