Skip to content

Instantly share code, notes, and snippets.

@Dmc0125
Last active March 15, 2021 10:46
Show Gist options
  • Select an option

  • Save Dmc0125/995782841fae6d4a168f0076705c7058 to your computer and use it in GitHub Desktop.

Select an option

Save Dmc0125/995782841fae6d4a168f0076705c7058 to your computer and use it in GitHub Desktop.
Bash profile, Nvm, Git, Mongo, Ubuntu

Basic setup

Ubuntu

NVM

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
  • add to bash profile
export NVM_DIR="$HOME/.nvm"
# This loads nvm
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# This loads nvm bash_completion
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

MongoDB

sudo apt-get install gnupg

wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
  • Reload local package database
sudo apt-get update
  • Install MongoDB packages
sudo apt-get install -y mongodb-org
  • Start MongoDB and enable it to start at reboot
systemctl start mongod
systemctl enable mongod
  • Check whether MongoDB is running correctly
systemctl status mongod

Git global config

git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

VSCode, git, mongo aliases, Custom prompt in bash

DEFAULT=$PS1

if test -d "dev"
then
    cd dev
fi

emojis=("πŸ‘Ύ" "🌐" "🎲" "🌍" "πŸ‰" "🌡")

EMOJI=${emojis[$RANDOM % ${#emojis[@]} ]}

txtgrn='\[\e[0;32m\]' # Green
txtgrey='\[\e[0;37m\]' # Light Grey
bldred='\[\e[1;31m\]' # Bold Red
bldgrn='\[\e[1;92m\]' # Bold Green
bldpur='\[\e[1;35m\]' # Bold Purple
blddef='\[\e[1;39m\]' # Bold Default
txtrst='\[\e[0;39m\]' # Text Reset

PS1="[\d \t] $bldred\u$txtgrey in $bldgrn\w\n$txtrst $EMOJI $ "

Aliases

# VS code aliases

alias code=code-oss
alias c='code .'

# GIT aliases

alias gi='git init'
alias gss='git status'
alias ga='git add'
alias gaa='git add .'
alias gc='git commit'
alias gcm='git commit -m'
alias gp='git push -u origin'
alias gpm='git push -u origin master'
alias grao='git remote add origin'

# MONGODB aliases

alias mdp='mongod --dbpath'
alias mcf='sudo mongod -f /etc/mongod.conf'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment