# vars PATH=$HOME/.scripts:/opt:/home/shihaam/.local/bin:$HOME/.shortcuts/wineprograms:$HOME/Applications:$PATH HISTSIZE=999999 HISTFILESIZE=999999 HISTCONTROL=ignoreboth:erasedups export GPG_TTY=$(tty) #Set GPG_TTY veriable, needed for signing git commits other gpg stuff export COMPOSE_DOCKER_CLI_BUILD=1 export DOCKER_BUILDKIT=1 #export SSH_CA_FILES=/home/shihaam/git/alliedmaldives/ops/ssh-ca export SSH_CA_FILES=$HOME/.ssh export SSH_CA_REVOCATION_LIST=$HOME/git/alliedmaldives/ops/ssh-ca/revoked_keys export SSL_FILES=$HOME/git/alliedmaldives/ops/ssl-certs #load ble.sh source ~/.local/share/blesh/ble.sh #load seafly prompt source ~/.bash-seafly-prompt/command_prompt.bash #always open last dir cd(){ builtin cd "$@" && pwd > ~/.cache/whereami;} cdl(){ cd $(cat ~/.cache/whereami);};cdl ip(){ if [[ $1 == "info" ]] then curl -s https://ipinfo.io/$2 | jq else command ip "$@" fi } ####### ALIASES ########## # add features #alias nano='nano -l' alias hdd='cd /mnt/hdd' alias drag=ripdrag #Adding output colors alias ls='ls --color=always' alias grep='grep --color=auto' alias less='less -R' alias ping='ping -O' # fix typos alias ckear=clear alias sl=ls alias ks=ls alias dc=cd ######################### #docker(){ # if [[ $1 == "compose" && $2 == "up" && $# -eq 2 ]]; then # docker compose up -d && docker compose logs -f # else # command docker "$@" # fi #} ##################### Some cool funcations hehe ############################### # do math in shell math(){ echo $1 | bc;} # Simpleway to see IP resolved to DNS record checkip(){ dig $1 +short;} # search for term and edit first file with that specific text edit(){ nano $(grep $1 * -R | awk '{print $1}'|cut -f1 -d ':' | head -n1);} #root(){ su -c "$@";} # view md file on cli catmd() { pandoc $1 | lynx -stdin;} # replace white spaces in file name with underscores rmspace() { for file in *; do mv -- "$file" "${file// /_}"; done;} yq() { podman run --rm -i -v "${PWD}":/workdir mikefarah/yq "$@" } ############################################################################### ### Enter container #enter () { # local container="$(echo "$1" | cut -d'_' -f1)" # if docker ps | grep "$container" >/dev/null 2>&1; then # docker exec -it "$container" bash # elif podman ps | grep "$container" >/dev/null 2>&1; then # podman exec -it "$container" bash # else # echo "Error: Container '$container' not found" >&2 # return 1 # fi #} enter () { local container="$1" # local container="$(echo "$1" | cut -d'_' -f1)" if docker ps | grep "$container" >/dev/null 2>&1; then docker exec -it "$container" bash elif podman ps | grep "$container" >/dev/null 2>&1; then podman exec -it "$container" bash else echo "Error: Container '$container' not found" >&2 return 1 fi } extract() { if [ -f "$1" ] ; then local folder_name=$(basename "$1" | sed -e 's/\..*$//') mkdir -p "$folder_name" case "$1" in *.tar.bz2) tar xvjf "$1" -C "$folder_name" ;; *.tar.gz) tar xvzf "$1" -C "$folder_name" ;; *.bz2) bunzip2 -k "$1" && mv "${1%.*}" "$folder_name" ;; *.rar) unrar x "$1" "$folder_name" ;; *.gz) gunzip -k "$1" && mv "${1%.*}" "$folder_name" ;; *.tar) tar xvf "$1" -C "$folder_name" ;; *.tbz2) tar xvjf "$1" -C "$folder_name" ;; *.tgz) tar xvzf "$1" -C "$folder_name" ;; *.zip) unzip "$1" -d "$folder_name" ;; *.Z) uncompress "$1" && mv "${1%.*}" "$folder_name" ;; *.7z) 7z x "$1" -o"$folder_name" ;; *.xz) xz --decompress --keep "$1" && mv "${1%.*}" "$folder_name" ;; *) echo "'$1' cannot be extracted via extract()" ;; esac else echo "'$1' is not a valid file" fi } #load neofetch #neofetch source /usr/share/nvm/init-nvm.sh PATH=$PATH:/home/shihaam/.wine/drive_c/users/shihaam/AppData/Roaming/.tlauncher/legacy/Minecraft shopt -s cdspell #fastfetch