| 1 |
# .bashrc |
| 2 |
|
| 3 |
# User specific aliases and functions |
| 4 |
|
| 5 |
# Source global definitions |
| 6 |
if [ -f /etc/bashrc ]; then |
| 7 |
. /etc/bashrc |
| 8 |
fi |
| 9 |
|
| 10 |
alias ll='ls -al' |
| 11 |
alias d='digikam' |
| 12 |
alias s='showfoto' |
| 13 |
alias n='ninja -j4' |
| 14 |
alias m='make -j4' |
| 15 |
alias f='sudo make install/fast' |
| 16 |
alias v='valgrind --tool=memcheck --leak-check=full --error-limit=no ' |
| 17 |
alias g='gdb --ex=r --args ' |
| 18 |
alias i='krazy2 --check i18ncheckarg ' |
| 19 |
alias j='krazy2 --check i18ncheckarg $(find * . 2> /dev/null)' |
| 20 |
alias c='cppcheck -j2 -DQ_OS_LINUX --verbose --inline-suppr --platform=unix64 --enable=all --report-progress \ |
| 21 |
--suppress=variableScope \ |
| 22 |
--suppress=purgedConfiguration \ |
| 23 |
--suppress=toomanyconfigs \ |
| 24 |
--suppress=unreadVariable \ |
| 25 |
--suppress=unusedVariable \ |
| 26 |
--suppress=unusedStructMember \ |
| 27 |
--suppress=unknownMacro \ |
| 28 |
--suppress=class_X_Y \ |
| 29 |
--suppress=ConfigurationNotChecked \ |
| 30 |
--suppress=unmatchedSuppression' |
| 31 |
|
| 32 |
function t() { tar -cjvf $1.tar.bz2 $1; } |
| 33 |
|
| 34 |
# Check OS name and version. |
| 35 |
|
| 36 |
OS_NAME=$(awk '/DISTRIB_ID=/' /etc/*-release | sed 's/DISTRIB_ID=//' | sed 's/\"//' | sed 's/\"//' | tr '[:upper:]' '[:lower:]') |
| 37 |
|
| 38 |
if [[ $OS_NAME == "" ]] ; then |
| 39 |
OS_NAME=$(lsb_release -a | grep 'Distributor ID:' | sed 's/Distributor ID://' | xargs | tr '[:upper:]' '[:lower:]') |
| 40 |
fi |
| 41 |
|
| 42 |
OS_ARCH=$(uname -m | sed 's/x86_//;s/i[3-6]86/32/') |
| 43 |
|
| 44 |
OS_VERSION=$(awk '/DISTRIB_RELEASE=/' /etc/*-release | sed 's/DISTRIB_RELEASE=//' | sed 's/[.]0/./') |
| 45 |
|
| 46 |
if [[ $OS_VERSION == "" ]] ; then |
| 47 |
OS_VERSION=$(lsb_release -a | grep 'Release:' | sed 's/Release://' | xargs | tr '[:upper:]' '[:lower:]') |
| 48 |
fi |
| 49 |
|
| 50 |
echo "$OS_NAME - $OS_ARCH - $OS_VERSION" |
| 51 |
|
| 52 |
if [[ "$OS_NAME" == "ubuntu" ]] ; then |
| 53 |
|
| 54 |
# See https://askubuntu.com/questions/1209994/ssh-key-registration-not-preventing-prompting-of-password |
| 55 |
# https://stackoverflow.com/questions/3466626/how-to-permanently-add-a-private-key-with-ssh-add-on-ubuntu |
| 56 |
|
| 57 |
added_keys=`ssh-add -l` |
| 58 |
|
| 59 |
if [ ! $(echo $added_keys | grep -o -e "$HOME/.ssh/id_rsa") ] ; then |
| 60 |
ssh-add "$HOME/.ssh/id_rsa" & |
| 61 |
fi |
| 62 |
|
| 63 |
else |
| 64 |
|
| 65 |
# Centos like distro |
| 66 |
|
| 67 |
eval `SSH_ASKPASS=/usr/libexec/openssh/ssh-askpass /usr/bin/keychain -q --eval --noask --agents ssh ~/.ssh/id_rsa` |
| 68 |
|
| 69 |
fi |
| 70 |
|
| 71 |
export GITSLAVE=.gitslave |
| 72 |
export SVN_EDITOR=mcedit |
| 73 |
export QT_LOGGING_RULES="digikam*=true" |
| 74 |
|
| 75 |
PATH=$PATH:~/Documents/scripts:/opt/cov-analysis-linux64-2021.12.1/bin:/opt/krazy/bin |
| 76 |
export PATH |
| 77 |
|
| 78 |
dkfrmcode() |
| 79 |
{ |
| 80 |
astyle --style=allman --indent=spaces=4 --convert-tabs --indent-switches \ |
| 81 |
--break-blocks --break-closing-brackets --pad-header \ |
| 82 |
--align-pointer=type --indent-col1-comments --add-brackets \ |
| 83 |
--min-conditional-indent=0 \ |
| 84 |
`find $1 -type f -name '*.cpp'` `find $1 -type f -name '*.c'` `find $1 -type f -name '*.h'` |
| 85 |
} |
| 86 |
|
| 87 |
dkgpg() |
| 88 |
{ |
| 89 |
cat ~/.gnupg/dkorg-gpg-pwd.txt | gpg --batch --yes --passphrase-fd 0 -sabv $1 |
| 90 |
rename asc sig $1.asc |
| 91 |
} |