Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save EntwistleOx/3eb08e5f535c2eb0f0b5e8a2d74e8fa2 to your computer and use it in GitHub Desktop.
Save EntwistleOx/3eb08e5f535c2eb0f0b5e8a2d74e8fa2 to your computer and use it in GitHub Desktop.
.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
HOST_NAME=TrustNo1
# Use node stable
source ~/.nvm/nvm.sh
nvm use stable
### EXPORT
export EDITOR="nvim"
export TERM="xterm-256color"
export HISTCONTROL=ignoredups:erasedups
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
### SHOPT
shopt -s autocd #Auto cd into folder
shopt -s cdspell # autocorrects cd misspellings
shopt -s cmdhist # save multi-line commands in history as single line
shopt -s dotglob
shopt -s histappend # append to the history, do not overwrite history
shopt -s expand_aliases # expand aliases
shopt -s checkwinsize # checks term size when bash regains control
# 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
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
export PATH=/home/entwistleox/.nvm/versions/node/v14.4.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
# Colors
txtred='\e[0;31m' # Red
bldred='\e[1;31m' # Bold Red
txtyel='\e[0;33m' # Yellow
bldyel='\e[1;33m' # Bold Yellow
txtyib='\e[3;1;33m' # Italic Bold Yellow
txtpur='\e[0;35m' # Magenta
bldpur='\e[1;35m' # Bold Magenta
txtblu='\e[0;94m' # Blue
bldblu='\e[1;94m' # Bold Blue
txtgre='\e[0;32m' # Green
txtgib='\e[3;1;32m' # Italic Bold Green
txtrst='\e[0m' # Text Reset
# Emojis
emojis=("👽" "👾")
EMOJI=${emojis[$RANDOM % ${#emojis[@]} ]}
# Show git branch name
force_color_prompt=yes
color_prompt=yes
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/  \1 /'
}
print_before_the_prompt () {
dir=$PWD
home=$HOME
dir=${dir/"$HOME"/"~"}
printf "\n $bldred%s: $txtblu%s $txtyib%s \n $txtrst" "$HOST_NAME" "$dir" "$(parse_git_branch)"
}
PROMPT_COMMAND=print_before_the_prompt
PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
PS1='$EMOJI  '
figlet -f digital -t -c 'It's too bad she won't live.' | lolcat
figlet -f digital -t -c 'But then again, who does?' | lolcat
#figlet -t -c 'Juan Diaz'
#figlet -t -c 'Web Developer'
### Aliases ###
# navigation
alias ..='cd ..'
alias .2='cd ../..'
alias .3='cd ../../..'
alias .4='cd ../../../..'
alias .5='cd ../../../../..'
# npm
alias nr='npm run'
alias ns='npm start'
alias nrd='npm run dev'
alias nrs='npm run serve'
alias nrt='npm run test'
alias ni='npm install'
alias nod='npm outdated --depth 0'
# CENCO NPM
alias nrdw='npm run build:dev'
alias nrdc='npm run build:copcl-v2:dev'
alias vs='code .'
alias aws='ssh -i .ssh/2call-aws.pem ubuntu@100.24.223.222'
alias mod='xmodmap'
alias wmouse='xev | grep button'
alias reboot='systemctl reboot'
alias poweroff='systemctl poweroff'
alias myphone='scrcpy'
alias getkey='xev | grep 'keycode''
alias pi='picom --experimental-backends -b'
alias kpi='killall picom'
alias deb='sudo dpkg -i '
alias v='nvim '
alias src='source ~/.bashrc'
# Git Aliases
alias gi='git init'
alias ga='git add'
alias gaa='git add .'
alias gc='git commit -m'
alias gl='git log'
alias gs='git status'
alias gpl='git pull'
alias gph='git push'
alias gbr='git branch'
alias gch='git checkout'
alias gchb='git checkout -b'
alias gcl='git clone'
alias gchpl='git checkout master && git pull'
alias gme='git merge'
alias gd='git branch -d'
alias gD='git branch -D'
# function as alias
gsquash() {
git reset --soft $(git merge-base master "$1") && git commit -am ""$1" Feature finished :ok_hand:" && git rebase -i master
}
# confirm before overwriting something
alias mv='mv -i'
alias rm='rm -i'
# the terminal rickroll
alias rr='curl -s -L https://raw.githubusercontent.com/keroserene/rickrollrc/master/roll.sh | bash'
alias cleanroot="dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment