Skip to content

Instantly share code, notes, and snippets.

Avatar

Vladimir Chistyakov b1ackviking

View GitHub Profile
@b1ackviking
b1ackviking / init.vim
Last active Apr 12, 2021
Minimal nvim configuration
View init.vim
call plug#begin('~/.local/share/nvim/plugged')
Plug 'editorconfig/editorconfig-vim'
if has('nvim') || has('patch-8.0.902')
Plug 'mhinz/vim-signify'
else
Plug 'mhinz/vim-signify', { 'branch': 'legacy' }
endif
Plug 'vhdirk/vim-cmake'
@b1ackviking
b1ackviking / gcc-includes.cmake
Created Mar 2, 2021
Extracting GCC system include directories
View gcc-includes.cmake
set(GCC_INCLUDE_DIRECTORIES)
if(WIN32)
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -v -x c++ -E NUL
ERROR_VARIABLE _gcc_output
OUTPUT_QUIET)
else()
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} -v -x c++ -E -
@b1ackviking
b1ackviking / cortex-gcc-flags.txt
Created Mar 1, 2021
GCC compiler options for Cortex cores (extract from GNU Tools for ARM Embedded Processors readme)
View cortex-gcc-flags.txt
Architecture options usage
--------------------------------------------------------------------
| ARM Core | Command Line Options | multilib |
|----------|--------------------------------------------|----------|
|Cortex-M0+| -mthumb -mcpu=cortex-m0plus | armv6-m |
|Cortex-M0 | -mthumb -mcpu=cortex-m0 | |
|Cortex-M1 | -mthumb -mcpu=cortex-m1 | |
| |--------------------------------------------| |
| | -mthumb -march=armv6-m | |
|----------|--------------------------------------------|----------|
View .bashrc
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
alias ls='ls --color=auto'
function parse_git_dirty {
View ASCII.cpp
enum class ASCII : char
{
eNUL,
eSOH,
eSTX,
eETX,
eEOT,
eENQ,
eACK,
eBEL,
@b1ackviking
b1ackviking / pre-commit.md
Created Feb 4, 2021
Как установить хуки на пре-коммит быстро и просто
View pre-commit.md

Как установить хуки на пре-коммит быстро и просто

Нужный софт

  • python3
  • pip - пакетный менеджер для питона (на винде идет вместе с питоном, на линуксе может быть отдельно)
  • clang-format
  • пакет cmakelang: pip install cmakelang
  • пакет pre-commit: pip install pre-commit

Все должно быть добавлено в PATH

View .clang-tidy
---
Checks: "clang-diagnostic-*,clang-analyzer-*,*,-abseil-*,abseil-no-namespace,-android-cloexec-fopen,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-type-vararg,-darwin-*,-fuchsia-*,fuchsia-statically-constructed-objects,fuchsia-trailing-return,-google-build-using-namespace,-google-readability-braces-around-statements,-google-runtime-references,-hicpp-braces-around-statements,-hicpp-vararg,-llvm-header-guard,-llvmlibc-*,-modernize-use-trailing-return-type,-readability-braces-around-statements,-readability-named-parameter,-hicpp-named-parameter"
WarningsAsErrors: ""
HeaderFilterRegex: ""
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
- key: bugprone-exception-escape.FunctionsThatShouldNotThrow
value: "WinMain;wWinMain"
- key: bugprone-misplaced-widening-cast.CheckImplicitCasts
View .pre-commit-config.yaml
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# exclude: '' # python regex
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
@b1ackviking
b1ackviking / .clang-format
Last active Apr 6, 2021
clang-format 11 cpp style
View .clang-format
---
Language: Cpp
# BasedOnStyle: Microsoft
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
@b1ackviking
b1ackviking / .clang-format
Last active Dec 10, 2020
clang-format 10 cpp style
View .clang-format
---
Language: Cpp
# BasedOnStyle: Microsoft
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: true