diff --git a/.aliases b/.aliases new file mode 100644 index 0000000..7b16ac6 --- /dev/null +++ b/.aliases @@ -0,0 +1,326 @@ +#!/bin/bash + +## DOWNLOADED FROM GIT REPO + +# My Alias + +# Custom ffmpeg shortcuts +# mp4 to mp3 +alias mp4-mp3-folder='for vid in *.mp4; do ffmpeg -i "$vid" -f mp3 -ab 320000 "${vid%.mp4}.mp3"; done' +alias mp4-mp3='mp4mp3(){ ffmpeg -i "$1" -f mp3 -ab 320000 "${1%.mp4}.mp3"; unset -f mp4mp3;}; mp4mp3' + +# mkv to mp4 +alias mkv-mp4-folder='for vid in *.mkv; do ffmpeg -i "$vid" -vcodec copy -acodec copy "${vid%.mkv}.mp4"; done' +alias mkv-mp4='mkvmp4(){ ffmpeg -i "$1" "${1%.mkv}.mp4"; unset -f mkvmp4;}; mkvmp4' + +# mkv to mp3 +alias mkv-mp3-folder='for vid in *.mkv; do ffmpeg -i "$vid" -vn -c:a libmp3lame -y "${vid%.mkv}.mp3"; done' +alias mkv-mp3='mkvmp3(){ ffmpeg -i "$1" -vn -c:a libmp3lame -y "${1%.mkv}.mp3"; unset -f mkvmp3;}; mkvmp3' + +# flac to mp3 +alias flac-mp3='flacmp3(){ ffmpeg -i "$1" -ab 320k -map_metadata 0 -id3v2_version 3 "${1%.flac}.mp3"; unset -f flacmp3;}; flacmp3' +alias flac-mp3-folder='for flac in *.flac; do ffmpeg -i "$flac" -ab 320k -map_metadata 0 -id3v2_version 3 "${flac%.flac}.mp3"; done' + +# webm to mp3 +alias webm-mp3='webmmp3(){ ffmpeg -i "$1" -vn -ab 128k -ar 44100 -y "${1%.webm}.mp3"; unset -f webmmp3;}; webmmp3' +alias webm-mp3-folder='for webm in *.webm; do ffmpeg -i "$webm" -ab 320k -map_metadata 0 -id3v2_version 3 "${webm%.webm}.mp3"; done' + +# avi to mp4 +alias avi-mp4-folder='for vid in *.avi; do ffmpeg -i "$vid" -c:v copy -c:a copy -y "${vid%.avi}.mp4"; done' +alias avi-mp4='avimp4(){ ffmpeg -i "$1" -c:v copy -c:a copy -y "${1%.avi}.mp4"; unset -f avimp4;}; avimp4' + + +# My IP Info +alias myip='curl -s https://ipv4.am.i.mullvad.net/json | python -m json.tool && echo' +alias ports-in-use='sudo lsof -i -P -n | grep LISTEN' + +# Typo +alias whosi='whois' +alias gti='git' +alias dc='cd' + +# Custom +alias untar='tar xvf' +alias nano='vim' +alias nanoo='/usr/bin/nano' +alias svim='sudo vim' +alias del='shred -f -n 30 -z -u -v' +alias del-quick='shred -f -n 3 -z -u -v' + + +#SAV Command +alias sav-start='sudo service sav-protect start' +alias sav-stop='sudo service sav-protect stop' + +# wget Shortcuts + +# Enable aliases to be sudo’ed +alias sudo='sudo ' + +# View HTTP traffic +function sniff() { + sudo ngrep -d $(ip route | grep '^default' | awk '{print $5}') -t '^(GET|POST) ' 'tcp and port 80' +} +function httpdump() { + sudo tcpdump -i $(ip route | grep '^default' | awk '{print $5}') -n -s 0 -w - | grep -a -o -E \"Host\\: .*|GET \\/.*\" +} +# Start-msfconsole +function mfsconsole-start(){ +if [ -d "/opt/sophos-av" ];then + sudo service sav-protect stop >> /dev/null + msfconsole + else + msfconsole + fi +} + +# nmap-basic +function nmap-initial() { + if [ -d "./nmap" ];then + sudo nmap -sC -sV -oA ./nmap/initial $1 -v + else + mkdir ./nmap + sudo nmap -sC -sV -oA ./nmap/initial $1 -v +fi +} + +# nmap-basic +function nmap-allports() { + if [ -d "./nmap" ];then + sudo nmap -sC -p- -oA "./nmap/$1-allports" $1 -v + else + mkdir ./nmap + sudo nmap -sC -p- -oA "./nmap/$1-allports" $1 -v +fi +} + +# Git Functions +function gpm() { + if [ "$(grep -c '\[branch "master"\]' .git/config )" -gt 0 ]; then + git push origin master + elif [ "$(grep -c '\[branch "main"\]' .git/config )" -gt 0 ]; then + git push origin main + else + echo "fatal: not a git repository (or any of the parent directories): .git" + fi +} + +function gac() { +if [ -d ".git" ]; then +echo "Log Message: " +read logmessage +git add --all && git commit --allow-empty-message -m "$logmessage" +else +echo "No .git Folder found in Directory. Are you in the Correct Folder?" +fi +} + + +# Pull all Git repos in this dir + +function pullall() { + for dir in * ; do + # Execute in subshell + ( + cd "$dir" || exit 1 + # If it's a git directory, then update it + if test -d .git; then + # Check if its Master or Main + if [ "$(grep -c -i ""master"" .git/config )" -gt 0 ]; then + echo "$dir is a Git repo. Pulling master branch..." && git checkout master && git pull && echo "" + + elif [ "$(grep -c -i ""main"" .git/config )" -gt 0 ]; then + echo "$dir is a Git repo. Pulling main branch..." && git checkout main && git pull && echo "" + fi + else + echo "$dir is not a Git repo." && echo "" + fi + ) + done +} + +# Pull Dotfiles inside ~/.dotfiles/ +function pulldots() { + # Check if folders are there and if its Master or Main + if grep -q -i "master" ~/.dotfiles/.git/config; then + CURRENTDIR=$(pwd) + echo "dotfiles Found, Pulling master branch..." + cd ~/.dotfiles/ + git checkout master + git pull + cd "$CURRENTDIR" + echo "" + + elif grep -q -i "main" ~/.dotfiles/.git/config; then + CURRENTDIR=$(pwd) + echo "dotfiles Found, Pulling main branch..." + cd ~/.dotfiles/ + git checkout main + git pull + cd "$CURRENTDIR" + echo "" + + else + echo "I can't seem to file any dotfiles folders" && echo "" + fi +} + +# Updates packages for all Distros +function update() { +sudo -v + +## Update Snaps + # if command -v snap >/dev/null; then + # echo "Updating Snaps..." + # sudo snap refresh + if [[ -f "/usr/bin/snapctl" ]];then + echo "Updating Snaps..." + sudo snap refresh + else + echo "No Snap Found" + fi + +## Update Flatpaks + + if [[ -f "/usr/bin/flatpak" ]];then + echo "Updating Flatpaks..." + sudo flatpak update + else + echo "No Flatpak Found" + fi + +## Parrot OS +if [ "$(grep -c "parrot" /etc/os-release)" -gt 0 ]; then + echo "Updating Apt Packages..." + if [ -d "/opt/sophos-av" ];then + sudo service sav-protect stop >> /dev/null + sudo parrot-upgrade -y && sudo apt full-upgrade -y + sudo service sav-protect start >> /dev/null + else + sudo parrot-upgrade -y && sudo apt full-upgrade -y + + fi +## Kali +elif [ "$(grep -c "kali" /etc/os-release)" -gt 0 ]; then + echo "Updating Apt Packages..." + if [ -d "/opt/sophos-av" ];then + sudo service sav-protect stop >> /dev/null + sudo apt update && sudo apt --autoremove full-upgrade -y + sudo service sav-protect start >> /dev/null + else + sudo apt update && sudo apt --autoremove full-upgrade -y + fi +## Debian +elif [ "$(grep -c "debian" /etc/os-release)" -gt 0 ]; then + echo "Updating Apt Packages..." + if [ -d "/opt/sophos-av" ];then + sudo service sav-protect stop >> /dev/null + sudo apt clean && sudo apt update && sudo apt full-upgrade -y + sudo service sav-protect start >> /dev/null + else + sudo apt clean && sudo apt update && sudo apt full-upgrade -y + fi +##Arch +elif [ "$(grep -c "arch" /etc/os-release)" -gt 0 ]; then + echo "Updating Pacman Packages" + if [ -d "/opt/sophos-av" ];then + sudo service sav-protect stop >> /dev/null + sudo pacman -Syy -y $$ && sudo -v && sudo pacman -Syu -y && sudo pacman --noconfirm -R $(pacman -Qdtq) + sudo service sav-protect start >> /dev/null + else + pacmanorphan=$(sudo pacman -Qdt) + sudo pacman -Syy -y && sudo -v && sudo pacman -Syu -y && sudo pacman --noconfirm -R $(pacman -Qdtq) + fi +## Fedora +elif [ "$(grep -c "fedora" /etc/os-release)" -gt 0 ]; then + echo "Updating DNF Packages" + if [ -d "/opt/sophos-av" ];then + sudo service sav-protect stop >> /dev/null + sudo dnf update -y && sudo dnf autoremove -y + sudo service sav-protect start >> /dev/null + else + sudo dnf update -y && sudo dnf autoremove -y + fi +else + echo "No apt or pacman found. I guess you're out of luck" + fi +} + +# Extract Function +extract() { + if [ ! -f "$1" ]; + then + printf '"%s" is not a valid file.' "$1" + exit 1 + fi + + case $1 in + *.tar.bz2) tar xjf "$1" ;; + *.tar.gz) tar xzf "$1" ;; + *.bz2) bunzip2 "$1" ;; + *.rar) unrar x "$1" ;; + *.gz) gunzip "$1" ;; + *.tar) tar xf "$1" ;; + *.tbz2) tar xjf "$1" ;; + *.tgz) tar xzf "$1" ;; + *.zip) unzip "$1" ;; + *.Z) uncompress "$1" ;; + *.7z) 7z x "$1" ;; + *.deb) ar x "$1" ;; + *.tar.xz) tar xf "$1" ;; + *) printf 'cannot extract "%s" with extract()' "$1" ;; + esac + } + +# Disable ipv6 +function ipv6-disable() { +sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 +sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 +} + +# Enable ipv6 +function ipv6-enable() { +sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 +sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0 +} + + +# Local IP lookup +alias ips="ip a | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'" +alias eth0="ip a s eth0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'" +alias eth1="ip a s eth1 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'" +alias wlan0="ip a s wlan0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'" +alias wlan1="ip a s wlan1 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'" +alias tun0="ip a s tun0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'" +alias tun1="ip a s tun1 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'" + + +# WG quick gen +alias wg-gen="wg genkey | sudo tee ~/wg/"$1"-priv | wg pubkey | sudo tee ~/wg/"$1"-pub" + +# Wireguard - TheHomeTunnel +alias thehometunnel-up="sudo wg-quick up TheHomeTunnel" +alias thehometunnel-down="sudo wg-quick down TheHomeTunnel" + +# Wireguard - C2-Gateway1 +alias c2-gateway1-up="sudo wg-quick up C2-Gateway1" +alias c2-gateway1-down="sudo wg-quick down C2-Gateway1" + + +# windirstat shortcut for ncdu +alias windirstat="ncdu" + +#What OS +alias os='cat /etc/os-release' + + +## Change Default Shell +alias shell="cat /etc/shells" +alias set-shell-bash="chsh -s /usr/bin/bash" +alias set-shell-zsh="chsh -s /usr/bin/zsh" +alias set-shell-tmux="chsh -s /usr/bin/tmux" + + +## Display all commands in this Alias file +alias my-alias="cat ~/.aliases | grep -oP 'alias\s\K[^=]+' | sort -n" + diff --git a/.bash_exports b/.bash_exports new file mode 100644 index 0000000..c5e6804 --- /dev/null +++ b/.bash_exports @@ -0,0 +1,5 @@ + +## DOWNLOADED FROM GIT REPO ## + +export EDITOR=/usr/bin/vim + diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..86563ab --- /dev/null +++ b/.bashrc @@ -0,0 +1,137 @@ + +## DOWNLOADED FROM GIT REPO ## + +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +export PATH=~/.links:~/.local/bin:/snap/bin:/usr/sandbox/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/share/games:/usr/local/sbin:/usr/sbin:/sbin:$PATH + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color) 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 + +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 + +if [ "$color_prompt" = yes ]; then + PS1="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]☢: \[\e[0m\]" +else + PS1='┌──[\u@\h]─[\w]\n└──╼ \$ ' +fi + +# Set 'man' colors +if [ "$color_prompt" = yes ]; then + man() { + env \ + LESS_TERMCAP_mb=$'\e[01;31m' \ + LESS_TERMCAP_md=$'\e[01;31m' \ + LESS_TERMCAP_me=$'\e[0m' \ + LESS_TERMCAP_se=$'\e[0m' \ + LESS_TERMCAP_so=$'\e[01;44;33m' \ + LESS_TERMCAP_ue=$'\e[0m' \ + LESS_TERMCAP_us=$'\e[01;32m' \ + man "$@" + } +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="\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]☢: \[\e[0m\]" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + alias dir='dir --color=auto' + alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# some more ls aliases +alias ll='ls -lh' +alias la='ls -lha' +alias l='ls -CF' +alias em='emacs -nw' +alias dd='dd status=progress' +alias _='sudo' +alias _i='sudo -i' +alias please='sudo' +alias fucking='sudo' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.aliases ]; then + . ~/.aliases +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 diff --git a/.profile b/.profile new file mode 100644 index 0000000..1af6360 --- /dev/null +++ b/.profile @@ -0,0 +1,26 @@ +##DOWNLOADED FROM GIT REPO## + +# ~/.profile: executed by the command interpreter for login shells. +# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login +# exists. +# see /usr/share/doc/bash/examples/startup-files for examples. +# the files are located in the bash-doc package. + +# the default umask is set in /etc/profile; for setting the umask +# for ssh logins, install and configure the libpam-umask package. +#umask 022 + +# if running bash +if [ -n "$BASH_VERSION" ]; then + # include .bashrc if it exists + if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" + fi + fi + + # set PATH so it includes user's private bin if it exists + if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" + fi +export PATH="$PATH:$HOME/opt/esp/xtensa-lx106-elf/bin" +export IDF_PATH="/opt/esp/ESP8266_RTOS_SDK" diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..c3bef61 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,38 @@ + +## DOWNLOADED FROM GIT REPO ## + +# Send prefix +set-option -j prefix C-j +bind-key C-j send-prefix +unbind-key C-j + +# Use Alt-arrow keys to switch panes +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +# Shift arrow to switch windows +bind -n S-Left previous-window +bind -n S-Right next-window +set -g mouse off + +# Set easier window split keys +bind-key v split-window -h +bind-key h split-window -v + +# Easy config reload +bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded." + + +#set -g status-interval 60 +#set -sg escape-time 1000 +#set-option -g base-index 1 +setw -g aggressive-resize on +set -g status-justify centre +set -g status-left-length 20 +set -g status-left "#[fg=red]#(echo 'IP ')#(curl -s http://ipecho.net/plain)" + +#show session name, window & pane number, date and time on right side of status bar +set -g status-right-length 60 +set -g status-right "#[fg=blue]#(hostname) #[fg=yellow]: %d %b %Y #[fg=green]: %l:%M %p" diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..23b14dc --- /dev/null +++ b/.vimrc @@ -0,0 +1,8 @@ +syntax on +set tabstop=4 +filetype on +set nu +set ruler +set mouse=a +set list + diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..0c41703 --- /dev/null +++ b/.zshrc @@ -0,0 +1,267 @@ +# ~/.zshrc file for zsh interactive shells. +# see /usr/share/doc/zsh/examples/zshrc for examples + +source $HOME/.aliases + +setopt autocd # change directory just by typing its name +#setopt correct # auto correct mistakes +setopt interactivecomments # allow comments in interactive mode +setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’ +setopt nonomatch # hide error message if there is no match for the pattern +setopt notify # report the status of background jobs immediately +setopt numericglobsort # sort filenames numerically when it makes sense +setopt promptsubst # enable command substitution in prompt + +WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word + +# hide EOL sign ('%') +PROMPT_EOL_MARK="" + +# configure key keybindings +bindkey -e # emacs key bindings +bindkey ' ' magic-space # do history expansion on space +bindkey '^U' backward-kill-line # ctrl + U +bindkey '^[[3;5~' kill-word # ctrl + Supr +bindkey '^[[3~' delete-char # delete +bindkey '^[[1;5C' forward-word # ctrl + -> +bindkey '^[[1;5D' backward-word # ctrl + <- +bindkey '^[[5~' beginning-of-buffer-or-history # page up +bindkey '^[[6~' end-of-buffer-or-history # page down +bindkey '^[[H' beginning-of-line # home +bindkey '^[[F' end-of-line # end +bindkey '^[[Z' undo # shift + tab undo last action + +# enable completion features +autoload -Uz compinit +compinit -d ~/.cache/zcompdump +zstyle ':completion:*:*:*:*:*' menu select +zstyle ':completion:*' auto-description 'specify: %d' +zstyle ':completion:*' completer _expand _complete +zstyle ':completion:*' format 'Completing %d' +zstyle ':completion:*' group-name '' +zstyle ':completion:*' list-colors '' +zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s +zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' +zstyle ':completion:*' rehash true +zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s +zstyle ':completion:*' use-compctl false +zstyle ':completion:*' verbose true +zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' + +# History configurations +HISTFILE=~/.zsh_history +HISTSIZE=1000 +SAVEHIST=2000 +setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE +setopt hist_ignore_dups # ignore duplicated commands history list +setopt hist_ignore_space # ignore commands that start with space +setopt hist_verify # show command with history expansion to user before running it +#setopt share_history # share command history data + +# force zsh to show the complete history +alias history="history 0" + +# configure `time` format +TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P' + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# 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 + +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 + +configure_prompt() { + prompt_symbol=㉿ + # Skull emoji for root terminal + #[ "$EUID" -eq 0 ] && prompt_symbol=💀 + case "$PROMPT_ALTERNATIVE" in + twoline) + PROMPT=$'%F{%(#.blue.green)}┌──${debian_chroot:+($debian_chroot)─}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))─}(%B%F{%(#.red.blue)}%n'$prompt_symbol$'%m%b%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]\n└─%B%(#.%F{red}#.%F{blue}$)%b%F{reset} ' + # Right-side prompt with exit codes and background processes + #RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)' + ;; + oneline) + PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{%(#.red.blue)}%n@%m%b%F{reset}:%B%F{%(#.blue.green)}%~%b%F{reset}%(#.#.$) ' + RPROMPT= + ;; + backtrack) + PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{red}%n@%m%b%F{reset}:%B%F{blue}%~%b%F{reset}%(#.#.$) ' + RPROMPT= + ;; + esac + unset prompt_symbol +} + +# The following block is surrounded by two delimiters. +# These delimiters must not be modified. Thanks. +# START KALI CONFIG VARIABLES +PROMPT_ALTERNATIVE=twoline +NEWLINE_BEFORE_PROMPT=yes +# STOP KALI CONFIG VARIABLES + +if [ "$color_prompt" = yes ]; then + # override default virtualenv indicator in prompt + VIRTUAL_ENV_DISABLE_PROMPT=1 + + configure_prompt + + # enable syntax-highlighting + if [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then + . /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern) + ZSH_HIGHLIGHT_STYLES[default]=none + ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=white,underline + ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold + ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline + ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold + ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline + ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold + ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline + ZSH_HIGHLIGHT_STYLES[path]=bold + ZSH_HIGHLIGHT_STYLES[path_pathseparator]= + ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]= + ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold + ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold + ZSH_HIGHLIGHT_STYLES[command-substitution]=none + ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold + ZSH_HIGHLIGHT_STYLES[process-substitution]=none + ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold + ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green + ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green + ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none + ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold + ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow + ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow + ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow + ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta + ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold + ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold + ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold + ZSH_HIGHLIGHT_STYLES[assign]=none + ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold + ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold + ZSH_HIGHLIGHT_STYLES[named-fd]=none + ZSH_HIGHLIGHT_STYLES[numeric-fd]=none + ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan + ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold + ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold + ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold + ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold + ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold + ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold + ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout + fi +else + PROMPT='${debian_chroot:+($debian_chroot)}%n@%m:%~%(#.#.$) ' +fi +unset color_prompt force_color_prompt + +toggle_oneline_prompt(){ + if [ "$PROMPT_ALTERNATIVE" = oneline ]; then + PROMPT_ALTERNATIVE=twoline + else + PROMPT_ALTERNATIVE=oneline + fi + configure_prompt + zle reset-prompt +} +zle -N toggle_oneline_prompt +bindkey ^P toggle_oneline_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty) + TERM_TITLE=$'\e]0;${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%n@%m: %~\a' + ;; +*) + ;; +esac + +precmd() { + # Print the previously configured title + print -Pnr -- "$TERM_TITLE" + + # Print a new line before the prompt, but only if it is not the first line + if [ "$NEWLINE_BEFORE_PROMPT" = yes ]; then + if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then + _NEW_LINE_BEFORE_PROMPT=1 + else + print "" + fi + fi +} + +# 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 LS_COLORS="$LS_COLORS:ow=30;44:" # fix ls color for folders with 777 permissions + + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' + alias diff='diff --color=auto' + alias ip='ip --color=auto' + + 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 + + # Take advantage of $LS_COLORS for completion as well + zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" + zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' +fi + +# some more ls aliases +alias ll='ls -l' +alias la='ls -A' +alias l='ls -CF' + +# enable auto-suggestions based on the history +if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then + . /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh + # change suggestion color + ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999' +fi + +if [ -f ~/.aliases ]; then + . ~/.aliases +fi + +# enable command-not-found if installed +if [ -f /etc/zsh_command_not_found ]; then + . /etc/zsh_command_not_found +fi + +export PATH=~/.links:$PATH + diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..f830cb7 --- /dev/null +++ b/install.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +## DOWNLOADED FROM GIT REPO ## + +# Find all dot files then if the original file exists, create a backup +# Once backed up to {file}.dtbak symlink the new dotfile in place +for file in $(find . -maxdepth 1 -name ".*" -type f -printf "%f\n" ); do + if [ -e ~/$file ]; then + mv -f ~/$file{,.dtbak} + fi + ln -s $PWD/$file ~/$file +done diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..9d68c0a --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +## DOWNLOADED FROM GIT REPO ## + +# Loop through all the dotfiles, if the file is a symlink then remove it +# Then if the backup file exists, restore it to it's original location +for file in $(find . -maxdepth 1 -name ".*" -type f -printf "%f\n" ); do + if [ -h ~/$file ]; then + rm -f ~/$file + fi + if [ -e ~/${file}.dtbak ]; then + mv -f ~/$file{.dtbak,} + fi +done + +echo "Uninstalled"