Skip to content

Instantly share code, notes, and snippets.

View grigory-rechistov-intel's full-sized avatar
💭
Working

Grigory Rechistov grigory-rechistov-intel

💭
Working
  • Intel Corporation
  • Sweden
View GitHub Profile
@grigory-rechistov-intel
grigory-rechistov-intel / switch-poly.cpp
Last active October 3, 2023 12:43
Replace switch-case's with polymorphism
// === Before ===
typedef enum {
Access_Vanilla,
Access_Special,
Access_Cache,
Access_Cache_L2,
Access_Invalid
} access_t;
@grigory-rechistov-intel
grigory-rechistov-intel / commit-msg
Created November 18, 2021 11:27
Git commit hook to check spelling
#!/bin/sh
# Check spelling
ASPELL=$(which aspell 2> /dev/null)
if [ $? -ne 0 ]; then
echo "Aspell not installed, unable to check spelling" >&2
else
WORDS=$(grep -v "^Change-Id:" "$1"| $ASPELL --mode=email --add-email-quote='#' list | sort -u)
if [ -n "$WORDS" ]; then
echo -ne "\e[31m"