Refactoring repository for GNU Stow

This commit is contained in:
Fabio Scotto di Santolo
2024-07-09 12:04:43 +02:00
parent 5056b975b7
commit 10b25049a3
222 changed files with 3 additions and 1633 deletions

7
bash/.bash_logout Normal file
View File

@@ -0,0 +1,7 @@
# ~/.bash_logout: executed by bash(1) when login shell exits.
# when leaving the console clear the screen to increase privacy
if [ "$SHLVL" = 1 ]; then
[ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q
fi

6
bash/.bash_profile Normal file
View File

@@ -0,0 +1,6 @@
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
[[ -f ~/.profile ]] && . ~/.profile

199
bash/.bashrc Normal file
View File

@@ -0,0 +1,199 @@
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
shopt -s autocd
shopt -s checkwinsize
shopt -s cdspell
shopt -s cmdhist
shopt -s histappend
shopt -s hostcomplete
# Make colorcoding available for everyone
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
# Background
On_Black='\e[40m' # Black
On_Red='\e[41m' # Red
On_Green='\e[42m' # Green
On_Yellow='\e[43m' # Yellow
On_Blue='\e[44m' # Blue
On_Purple='\e[45m' # Purple
On_Cyan='\e[46m' # Cyan
On_White='\e[47m' # White
NC="\e[m" # Color Reset
# new alert text
ALERT=${BWhite}${On_Red} # Bold White on red background
# Creates an archive (*.tar.gz) from given directory.
function maketar() { tar cvzf "${1%%/}.tar.gz" "${1%%/}/"; }
# Create a ZIP archive of a file or folder.
function makezip() { zip -r "${1%%/}.zip" "$1" ; }
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
else
if [ -f $1 ] ; then
# NAME=${1%.*}
# mkdir $NAME && cd $NAME
case $1 in
*.tar.bz2) tar xvjf ../$1 ;;
*.tar.gz) tar xvzf ../$1 ;;
*.tar.xz) tar xvJf ../$1 ;;
*.lzma) unlzma ../$1 ;;
*.bz2) bunzip2 ../$1 ;;
*.rar) unrar x -ad ../$1 ;;
*.gz) gunzip ../$1 ;;
*.tar) tar xvf ../$1 ;;
*.tbz2) tar xvjf ../$1 ;;
*.tgz) tar xvzf ../$1 ;;
*.zip) unzip ../$1 ;;
*.Z) uncompress ../$1 ;;
*.7z) 7z x ../$1 ;;
*.xz) unxz ../$1 ;;
*.exe) cabextract ../$1 ;;
*) echo "extract: '$1' - unknown archive method" ;;
esac
else
echo "$1 - file does not exist"
fi
fi
}
function pacsrc() {
packages=("$@")
for pack in "${packages[@]}"
do
echo -e "\n"
echo "======================================== $pack ========================================"
echo -e "\n"
yay -Ss $pack
done
}
# jump directorys upwards until it hits a directory with multiple folders
function up(){
local d=""
limit=$1
for ((i=1 ; i <= limit ; i++))
do
d=$d/..
done
d=$(echo $d | sed 's/^\///')
if [ -z "$d" ]; then
d=..
fi
cd $d
}
# create an directory and directly cd into it
function mcd() {
mkdir -p $1
cd $1
}
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
function my_ip() {
INTERFACE=`ip addr | awk '/state UP/ {print $2}' | sed 's/.$//'`
echo `/sbin/ifconfig $INTERFACE | awk "/inet/ {print $2} " | sed -e s/addr://`
}
function welcome() {
#------------------------------------------
#------WELCOME MESSAGE---------------------
# customize this first message with a message of your choice.
# this will display the username, date, time, a calendar, the amount of users, and the up time.
clear
# Gotta love ASCII art with figlet
#figlet "Welcome, " $USER;
toilet -f starwars -t "Welcome, " $USER;
#echo -e ""; cal ;
screenfetch 2> /dev/null
echo ""
echo -ne "Today is "; date
echo -e ""
echo -ne "Up time:";uptime | awk /'up/'
echo -en "Local IP Address : "; my_ip | awk '{print $2}'
echo "";
}
[ -r $HOME/.bashrc.aliases ] && . $HOME/.bashrc.aliases
# export QT_STYLE_OVERRIDE=gtk
# export QT_SELECT=qt5
if [[ $LANG = '' ]]; then
export LANG=it_IT.UTF-8
fi
if [ -n "$SSH_CLIENT" ]; then
ssh_placeholder=' {SSH::SESSION}'
fi
if [ -f $HOME/.bash-git-prompt/gitprompt.sh ]; then
# To only show the git prompt in or under a repository directory
GIT_PROMPT_ONLY_IN_REPO=0
# To use upstream's default theme
GIT_PROMPT_THEME=Custom
source $HOME/.bash-git-prompt/gitprompt.sh
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
[ -e "/etc/DIR_COLORS" ] && DIR_COLORS="/etc/DIR_COLORS"
[ -e "$HOME/.dircolors" ] && DIR_COLORS="$HOME/.dircolors"
[ -e "$DIR_COLORS" ] || DIR_COLORS=""
#eval "`dircolors -b $DIR_COLORS`"
# added by travis gem
[ -f /home/plague/.travis/travis.sh ] && source /home/plague/.travis/travis.sh
# Set up Node Version Manager
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
#welcome
#eval $(thefuck --alias)
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/home/plague/.sdkman"
[[ -s "/home/plague/.sdkman/bin/sdkman-init.sh" ]] && source "/home/plague/.sdkman/bin/sdkman-init.sh"
. "$HOME/.cargo/env"

49
bash/.bashrc.aliases Normal file
View File

@@ -0,0 +1,49 @@
#
# ~/.bashrc.aliases
#
# Alias di cambio directory
alias ..="cd .."
alias ...="cd ../.."
alias .3="cd ../../.."
alias .4="cd ../../../.."
alias .5="cd ../../../../.."
alias cd..="cd .."
alias home="cd ~"
# Alias del comando ls
alias l='ls -CF '
alias ls="ls -CF"
alias lla="ls -lisah"
alias ll="ls -lh"
alias la="ls -CFa"
alias lsl="ls -lhFA | less"
# Output colorato comandi vari
alias grep='grep --color=auto'
alias gcc='colorgcc'
alias diff='colordiff'
# Alias vari
alias path='echo -e ${PATH//:/\\n}' # path: Echo all executable Paths
alias mkdir="mkdir -pv"
alias journalctl='sudo journalctl'
alias failed='sudo systemctl --failed'
alias se='ls /usr/bin | grep'
alias df='df -h'
alias du='du -h'
alias please='sudo $(fc -ln -1)'
alias userlist="cut -d: -f1 /etc/passwd | sort"
alias fhere="find . -name "
alias free="free -mth"
alias ps="ps auxf"
alias psgrep="ps aux | grep -v grep | grep -i -e VSZ -e"
alias wget="wget -c"
alias histg="history | grep"
alias myip="curl http://ipecho.net/plain; echo"
alias logs="find /var/log -type f -exec file {} \; | grep 'text' | cut -d' ' -f1 | sed -e's/:$//g' | grep -v '[0-9]$' | xargs tail -f"
alias folders='find . -maxdepth 1 -type d -print0 | xargs -0 du -sk | sort -rn'
alias vpn-add='nmcli connection import type openvpn file'
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'