The Coding Notebook
Memorable coding moments of a software engineer
Setup WSL for development
Whenever I spin up a new WSL instance there is a set of packages I like to install to prepare the machine to be used for dev. This is the list.



# How I setup my wsl for dev?

## .bashrc
I like adding these to my bashrc
```bash
# -------------- MY STUFF -------------------
alias ll='ls -alh --color'
alias vi='vim'
alias gits='git status'
alias gitp='git pull && git fetch --tags'
alias gita='git add . && git status'
alias cls='echo -e "\0033\0143"'
alias code='/mnt/c/Program\ Files/Microsoft\ VS\ Code/Code.exe'

export PATH=$PATH:$HOME/.local/bin:$HOME/bin
export NODE_ENV=dev
export PS1='\[\033]0;$MSYSTEM:\w\007\]\n\[\033[31m\]\u@\h \[\033[33m\]\w`__git_ps1`\[\033[0m\]\n$ '

cd <My Projects Dir>

# -------------------------------------------
```
The PS1 creates this prompt:
<div style="background-color: black">
<span style="color:red">user@machine</span> <span style="color:gold">[path] (git branch if any)</span>
<br><span style="color:white">$</span>
</div>

## Installing make / gcc /etc
These come from `build-essential`
```bash
sudo apt-get update
sudo apt-get install build-essential
```

## .vimrc
My `~/.vimrc` file (vim settings):
```bash
colo desert
syntax on
set number
```

## SSH key
If needed, generate a new ssh key to add to github/bitbucket etc:
```bash
ssh-keygen -t rsa -b 4096
```

## Python3
WSL usually comes with `python3` installed, but there is no `python`, I don't need python2 but do need python to run python3, the easiest way I found was to simply create a symlink:
```bash
sudo ln -s /usr/bin/python3 /usr/bin/python
```

Installing pip:
```bash
sudo apt-get install python3-pip
# Upgrade to latest pip
sudo -H pip3 install --upgrade pip
```

Installing python3-dev (possible it's already installed, doesn't hurt to try):
```bash
sudo apt-get install python3-dev
```

## Installing node.js
Best is to look for instruction on [nodejs website](https://nodejs.org/) for installation instructions, as of today the packages are maintained by nodesource on [GitHub](https://github.com/nodesource/distributions/blob/master/README.md)