# Last edit: 20250912

# Python
alias py="python3"
alias ipy="ipython3"

# CERN
alias vm='ssh scarsivm8'
alias vm9='ssh scarsivm9'
alias lx='ssh scarsi@lxplus.cern.ch'
alias lx-proxy="ssh -D 1080 scarsi@lxtunnel.cern.ch -f -N"

# *** CUSTOM ALIASES ***
alias tt='tmux a'
alias chx='chmod u+x'
alias ll='ls -lh'
alias ltr="ls -lhtr"
alias grep="grep -I"


# Redefine commands to avoid disasters...
alias cp='cp -iv'
alias rm='rm -iv'
alias mv='mv -iv'



# Obtain git branch
parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

# PS1 String like my Ubuntu
PS1='${debian_chroot:+($debian_chroot)}\[\033[38;5;10m\]\u\[\033[38;5;10m\]@\[\033[38;5;45m\]\h\[\033[00m\]:\[\033[38;5;11m\]\w\[\033[38;5;214m\]$(parse_git_branch)\[\033[38;5;9m\] \$ \[\033[00m\]'


# Show real path resolving symlinks
rpwd() {
        echo $(realpath $(pwd))
}

# Create directory if does not exists and cd to it
mkcd(){
        mkdir -p $1
        cd $1
}

# List all processes with a given name
p(){
        ps aux | grep -i $1 | grep -ve "grep"
}

# Kill all processes with a given name
ka(){
        kill -9 $(ps aux | grep -i $1 | grep -ve "grep" | awk '{print $2}')
}

# du and sorting
dusort(){
	[ $# -ge 1 ] && {
		du -d $1 -h | sort -h
	} || {
		du -sh | sort -h
	}
}


# *** NI ALIASES ***
alias sv='LD_PRELOAD=/lib/x86_64-linux-gnu/libudev.so.1 vivado -stack 2000 &'
alias ddd="ssh utente@d1.sw -XY -p"
alias sss="cd /sharedVolume"
alias ni-proxy="ssh -f -N ni-proxy"

# *** Ionos alaises ***
alias ionos="ssh pitoneverde@pitoneverde.it"
alias ionos-forward="ssh -f -N ionos-forward"
alias ionos-proxy="ssh -f -N ionos-proxy"
alias criett-proxy="ssh -f -N CRIETT-proxy"

# *** MISC ALIASES ***
alias pappagallo="curl parrot.live"
