2023-10-25 19:00:04 +02:00

300 lines
9.0 KiB
Plaintext
Executable File

#neofetch
case $- in # If not running interactively, don't do anything
*i*) ;;
*) return;;
esac
####################
### BUILTINS ###
####################
enable -n echo
## ## ## ## ## ##
####################
### SETTINGS ###
####################
## GLOBS ##
shopt -s dotglob # With this set, the glob matches hidden files (".*") by default,
# but not the . or .. links.
shopt -s globstar # If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
shopt -s extglob # Enable additional globs. Resulting in what is effectively a Regex
# language builtin to Bash.
## PROMPT ##
# Set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# Uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
# Deffault Kali shit. ?!
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
# Fancy prompts
if [ "$color_prompt" = yes ]; then
prompt_color='\[\033[;32m\]'
info_color='\[\033[1;34m\]'
prompt_symbol=♞ # 🩓
if [ "$EUID" -eq 0 ]; then # Change prompt colors for root user
prompt_color='\[\033[;94m\]'
info_color='\[\033[1;31m\]'
prompt_symbol=♛
fi
PS1=$prompt_color'┌──${debian_chroot:+($debian_chroot)──}('$info_color'\u${prompt_symbol}\h'$prompt_color')-[\[\033[0;1m\]\w'$prompt_color']\n'$prompt_color'└─'$info_color'\$\[\033[0m\] '
PS2=$prompt_color'>\[\033[0m\]'
# BackTrack red prompt
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# Enable color support of ls, less and man, and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
fi
## HISTORY ##
HISTCONTROL=erasedups # remove duplicates
shopt -s histappend # append to the history file, don't overwrite it
shopt -s lithist # save multiline commands with embeded newlines
HISTSIZE=1000
HISTFILESIZE=2000
HISTTIMEFORMAT='%y/%m/%d %T: '
shopt -s checkwinsize # check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s cdspell # If set, minor errors in the spelling of a directory component in a cd
# command will be corrected. The errors checked for are transposed characters,
# a missing character, and a character too many.
set -o vi # Turn on vi mode
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # Make less more friendly for non-text input files, see lesspipe(1)
#if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then # Set variable identifying the chroot you work in (used in the prompt below)
# debian_chroot=$(cat /etc/debian_chroot)
#fi
## ## ## ## ## ##
#####################
### VARIABLES ###
#####################
#FOO="bar"
## DEFAULT APPLICATIONS ##
export EDITOR="vim"
export VISUAL="vim"
BROWSER="firefox"
IMG_VIEWER="nomacs"
## PATHS ##
MM="${HOME}/mm"
CDPATH="${MM}"
export PATH="${PATH}:~/mm/bin"
export PYTHONPATH="${PYTHONPATH}~/mm/lib"
## PROGRAMS ##
# gcc #
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# gpg #
GPG_TTY=$(tty)
export GPG_TTY
export PINENTRY_USER_DATA="USE_CURSES=1"
# fff #
#export FFF_HIDDEN=1 # show hidden (how counterintuitive...)
#export FFF_LS_COLORS=1
##export FFF_OPENER="openie"
#export FFF_FILE_FORMAT=" %f"
#export FFF_FAV1="${MM}/"
#export FFF_FAV2="${HOME}"
##export FFF_FAV1="~/Deskop/minecraft\ mod/"
#export NNN_PRUG="p:preview-tabbed;o:organize"
## MISC ##
export auto_resume=1
IGNOREEOF=3
#########################
###################
### ALIASES ###
###################
# Output controll:
# Core
alias ls='ls -a --color=auto'
alias ll='ls -l -F'
alias l='ls -CF'
alias cp='cp -v'
alias mv='mv -v'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias echo='echo -e'
alias diff='diff -s -y -t --color=auto' # report identical; side-by-side; expand tabs; color
alias hexedit='hexedit --color'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias df='df --print-type'
alias ip='ip --color=auto'
# GNU
alias tar='tar -v'
alias gzip='gzip -v'
alias gdb='gdb -q'
# PKG managment
alias pacman='pacman --color=auto'
alias yay='yay --color=auto'
# Misc.
alias bat='bat --paging=never --italic-text always'
#alias nnn='nnn -d -H -x'
alias xclip='xclip -selection clipboard'
alias tt="tt -t 60 -bold -n 120 -g 120 -nobackspace -noskip -oneshot -csv -blockcursor -theme slate"
alias wget='wget --restrict-file-names=windows,ascii'
alias tshark='tshark --color'
# Ease of use
alias sudo='sudo '
alias cls="clear"
alias mkdir="mkdir -p"
alias cdb="cd \"${OLDPWD}\""
alias close="exit"
alias quit="exit"
alias figlet="figlet -w 120 -d ~/mm/Fonts/figlet-fonts/"
alias heavyDuty=". ${MM}/Bash/Bashrc/.heavyDutyrc"
alias locatei="locate -i"
# Safety
alias rm='rm -I'
alias gpg='gpg -i --no-symkey-cache'
#alias youtube-dl='youtube-dl --restrict-filenames --no-overwrites'
alias yt-dlp='yt-dlp --restrict-filenames --no-overwrites'
#alias tar='tar --verify'
# Vimification
alias :e="${EDITOR}"
alias :q="exit"
alias :qa="xdotool getactivewindow windowkill"
# Shortcuts
alias music="ls ${HOME}/Music | shuf -n 1 --random-source=/dev/urandom"
alias downloadstories-folder="xdg-open ${MM}/Python/bots/downloaders/instagram/."
alias god-e="${EDITOR} ${MM}/C++/God/main.cpp"
alias xmrig="sudo ${MM}/biz/monero/xmrig-6.9.0/xmrig"
alias curlency="curl -X GET https://openexchangerates.org/api/latest.json?app_id=1b356f1e65e24ddb8d56a73c1da2d900"
alias órarend="${IMG_VIEWER} ~/mm/házidolgozatok/EKKE/órarend"
# Folders
alias books="xdg-open ${MM}/Archive/text/books/"
alias ekke="xdg-open ${MM}/házidolgozatok/EKKE"
alias mm="xdg-open ${MM}/."
# Files with editor
alias bashrc="${EDITOR} ${HOME}/.bashrc"
alias vimrc="${EDITOR} ${HOME}/.vimrc"
alias pufka="${EDITOR} ${MM}/C++/pufka.cdd"
alias owned-tech="${EDITOR} ${MM}/Personal/owned.db/tech.list"
alias msgbuffer="${EDITOR} ${MM}/Personal/Msg/msg.buf"
alias stibuffer="${EDITOR} ${MM}/Personal/Notes/short-term_ideas.buf"
# Programs
# Games
alias xonotic="cd Xonotic; cd ./Xonotic; ./xonotic-linux64-sdl"
# Lists
alias todo="cd ${MM}/God && ./todo; cd \"${OLDPWD}\""
alias toget="cd ${MM}/God && ./toget; cd \"${OLDPWD}\""
alias devl="cd ${MM}/God && ./devl; cd \"${OLDPWD}\""
alias list="cd ${MM}/God && ./Lists; cd \"${OLDPWD}\""
alias ach="cd ${MM}/God && ./Ach; cd \"${OLDPWD}\""
alias god="cd ${MM}/God && ./God; cd \"${OLDPWD}\""
alias diy="cd ${MM}/diy/.Idea_list && ./diy; cd \"${OLDPWD}\""
# Scripts
alias txt="txt.txt.sh"
alias cddpp="cdd_postprocessor.py"
alias mkdirs="${MM}/Linux/Bash/Aliased_scripts/mkdirs.sh"
alias downloadstories="python3 ${MM}/Python/bots/downloaders/instagram/story_dowloader.py"
#########################
#####################
### FUNCTIONS ###
#####################
function mkdircd() { mkdir -p "$@" && eval cd "\"\$$#\""; }
function cdu() {
if [[ $# -eq 0 ]]; then
cd ..
return
fi
for ((i=0 ; i <= $# ; i++)); do
cd ..
done
}
function f() {
fff "$@"
cd "$(cat "${XDG_CACHE_HOME:=${HOME}/.cache}/fff/.fff_d")"
}
#########################
# 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