Created
June 28, 2022 07:50
-
-
Save brandovidal/f3dec936c8479dcae5213a7449f3a475 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path to your oh-my-zsh installation. | |
export ZSH="$HOME/.oh-my-zsh" | |
# Which plugins would you like to load? | |
plugins=( | |
archlinux | |
colorize | |
gcloud | |
git | |
github | |
node | |
nvm | |
vscode | |
) | |
source $ZSH/oh-my-zsh.sh | |
# Fix the Java Problem | |
export _JAVA_AWT_WM_NONREPARENTING=1 | |
# Enable Powerlevel10k instant prompt. Should stay at the top of ~/.zshrc. | |
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
fi | |
# Set up the prompt | |
autoload -Uz promptinit | |
promptinit | |
prompt adam1 | |
setopt histignorealldups sharehistory | |
# Use emacs keybindings even if our EDITOR is set to vi | |
bindkey -e | |
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history: | |
HISTSIZE=1000 | |
SAVEHIST=1000 | |
HISTFILE=~/.zsh_history | |
# Use modern completion system | |
autoload -Uz compinit | |
compinit | |
zstyle ':completion:*' auto-description 'specify: %d' | |
zstyle ':completion:*' completer _expand _complete _correct _approximate | |
zstyle ':completion:*' format 'Completing %d' | |
zstyle ':completion:*' group-name '' | |
zstyle ':completion:*' menu select=2 | |
eval "$(dircolors -b)" | |
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} | |
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-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' | |
zstyle ':completion:*' menu select=long | |
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s | |
zstyle ':completion:*' use-compctl false | |
zstyle ':completion:*' verbose true | |
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' | |
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' | |
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | |
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh | |
# User configuration | |
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 | |
# Manual aliases | |
alias ll='lsd -lh --group-dirs=first' | |
alias la='lsd -a --group-dirs=first' | |
alias l='lsd --group-dirs=first' | |
alias lla='lsd -lha --group-dirs=first' | |
alias ls='lsd --group-dirs=first' | |
alias cat='bat' | |
# Git aliases | |
alias gmasu="gcm && g fetch upstream && g reset --hard upstream/master && ggpush -f" | |
alias gmaso="gcm && g fetch origin && g reset --hard origin/master" | |
alias gaem="g commit --allow-empty -m" | |
alias grmum='git rebase -i $(git merge-base HEAD upstream/master)' | |
alias grmom='git rebase -i $(git merge-base HEAD origin/master)' | |
# nvm aliases | |
alias nvmu="nvm use" | |
alias nvmx="nvm use 10" | |
alias nvmy="nvm use 12" | |
alias nvmz="nvm use 15" | |
# npm and yarn aliases | |
alias npms="npm start" | |
alias npmd="npm run dev" | |
alias npmb="npm run build" | |
alias npmc="npm run clean" | |
alias npml="npm run lint" | |
alias npmlf="npm run lint-fix" | |
alias npmk="npm run kill" | |
alias yarns="yarn start" | |
alias yarnd="yarn run dev" | |
alias yarnb="yarn run build" | |
alias yarnl="yarn run lint" | |
alias yarnlf="yarn run lint-fix" | |
alias yarnc="yarn run clean" | |
alias yarnk="yarn run kill" | |
# node_modules aliases | |
alias rmnpmi="rm -rf node_modules && npm cache clean --force && npm i" | |
alias rmyarn="rm -rf node_modules && yarn cache clean && yarn --force" | |
alias rmpack="rm -rf node_modules && rm -rf packages/**/node_modules && yarn --force" | |
alias cryarn="yarn clean-repo" | |
# pyenv aliases | |
alias pyg2="pyenv global 2.7.17" | |
alias pyg3="pyenv global 3.6.7" | |
# utils aliases | |
alias rmorig="rm -rf **/*.orig" | |
#alias rm="trash" | |
alias cl="clear" | |
# General path | |
export EDITOR=micro | |
# Manual configuration | |
PATH=/root/.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:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games | |
# Manual aliases | |
alias ll='lsd -lh --group-dirs=first' | |
alias la='lsd -a --group-dirs=first' | |
alias l='lsd --group-dirs=first' | |
alias lla='lsd -lha --group-dirs=first' | |
alias ls='lsd --group-dirs=first' | |
alias cat='bat' | |
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh | |
# Plugins | |
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh | |
source /usr/share/zsh-sudo/sudo.plugin.zsh | |
# Functions | |
function mkt(){ | |
mkdir {nmap,content,exploits,scripts} | |
} | |
# Extract nmap information | |
function extractPorts(){ | |
ports="$(cat $1 | grep -oP '\d{1,5}/open' | awk '{print $1}' FS='/' | xargs | tr ' ' ',')" | |
ip_address="$(cat $1 | grep -oP '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' | sort -u | head -n 1)" | |
echo -e "\n[*] Extracting information...\n" > extractPorts.tmp | |
echo -e "\t[*] IP Address: $ip_address" >> extractPorts.tmp | |
echo -e "\t[*] Open ports: $ports\n" >> extractPorts.tmp | |
echo $ports | tr -d '\n' | xclip -sel clip | |
echo -e "[*] Ports copied to clipboard\n" >> extractPorts.tmp | |
cat extractPorts.tmp; rm extractPorts.tmp | |
} | |
# Set 'man' colors | |
function 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 "$@" | |
} | |
# fzf improvement | |
function fzf-lovely(){ | |
if [ "$1" = "h" ]; then | |
fzf -m --reverse --preview-window down:20 --preview '[[ $(file --mime {}) =~ binary ]] && | |
echo {} is a binary file || | |
(bat --style=numbers --color=always {} || | |
highlight -O ansi -l {} || | |
coderay {} || | |
rougify {} || | |
cat {}) 2> /dev/null | head -500' | |
else | |
fzf -m --preview '[[ $(file --mime {}) =~ binary ]] && | |
echo {} is a binary file || | |
(bat --style=numbers --color=always {} || | |
highlight -O ansi -l {} || | |
coderay {} || | |
rougify {} || | |
cat {}) 2> /dev/null | head -500' | |
fi | |
} | |
function rmk(){ | |
scrub -p dod $1 | |
shred -zun 10 -v $1 | |
} | |
# Finalize Powerlevel10k instant prompt. Should stay at the bottom of ~/.zshrc. | |
(( ! ${+functions[p10k-instant-prompt-finalize]} )) || p10k-instant-prompt-finalize | |
source ~/powerlevel10k/powerlevel10k.zsh-theme | |
bindkey "^[[H" beginning-of-line | |
bindkey "^[[F" end-of-line | |
bindkey "^[[3~" delete-char | |
bindkey "^[[1;3C" forward-word | |
bindkey "^[[1;3D" backward-word |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment