Pick a random reviewer
Most teams have a certain code-review-process. But most of the time there is no “round robin”-implementation who will be the reviewer, but the coder itself should select the reviewer. Because of domain-knowledge, etc. And then you her lots of times “I am currently busy. Not me!”
Solution: random and fair selection via bash.
1 2 3 4 5 6 7 8 |
#!/bin/bash # initialize the array array=(MSA MBH HGA GSC MPE NLE RNI MLA) size=${#array[@]} index=$(($RANDOM % $size)) echo "Mister ${array[$index]} is your candidate as reviewer. Congratulations!" echo "In case you picked yourself - just rerun ;))" |
Current version of the script can be found at: https://github.com/marcelpetrick/bashCollection/blob/master/randomReviewer.sh
Inspired by a stack-overflow answer.
find the fattest files of certain type
1 |
$ find . -name "*.LSimg" -exec ls -al {} \; | sort -nr -k5 >> listOfFattestFiles.txt |
creates something like
1 2 3 4 |
-rw-r--r-- 1 mpe 1049089 323707001 Mai 29 2018 ./a.LSimg -rw-r--r-- 1 mpe 1049089 21342433 Mai 29 2018 ./b/c.LSimg -rw-r--r-- 1 mpe 1049089 21342432 Mai 29 2018 ./e.LSimg .. |
Fixing ~crappy~ no-good Qt-includes
How to locate all includes of that style:
1 |
#include <QtWidgets/qcombobox.h> |
with proper
1 |
#include <QtWidgets/QComboBox> |
Fired up https://regex101.com/ and set it to PHP and created an expression, which matches:
starting with slash, then a q, then characters, then . then h
1 |
\/[qQ][a-zA-Z]+\.h |
(Replace & check has to be done by YOU ;))
Fix whitespace
Sometimes there is too much whitespace and tabs in my last commit.
In former times I used a VisualStudio-plugin, but this is not helpful there. So I wrote a small script (see on my github) which:
• replaces all tabs with four spaces
• removes all trailing whitespace
• converts line-endings to CRLF
I invoke it on the list of all changes files in my last commit in the git-repo with:
1 |
$ git diff --name-only HEAD~1 HEAD | xargs -L1 ../removeTrailing.sh |
(first part gives you a list of changed files and then feeds it to the script for execution)
Overview of author-activities for the git-repo
If some ‘sophisiticated’ tool like git-stats is too cumbersome to configure, just do some git-log and shell-magic:
1 2 3 4 5 6 7 |
$ git log --format='%aN' | sort | uniq -c | sort 4 Hans Wurst 6 Klaus Blume 6 Bernd Meier 26 Marcel Petrick 32 Ali Baba 37 Linus Torvalds |
Ok, just noticed that git has something built-in:
1 |
$ git shortlog -sn |
from: https://coderwall.com/p/pek-yg/git-statistics-for-repo-per-author – Thanks Marcin Olichwirowicz!