Skip to content

Instantly share code, notes, and snippets.

@sspross
Last active August 13, 2020 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sspross/df980d6985ad512a014fa861632f776d to your computer and use it in GitHub Desktop.
Save sspross/df980d6985ad512a014fa861632f776d to your computer and use it in GitHub Desktop.
Switch to Windows

Setup

Windows

  • WSL2 is so much faster, upgrade to the Windows Insider Program: https://docs.microsoft.com/en-us/windows/wsl/wsl2-install
  • Turn "Windows Subsystem for Linux" on (Control Panel > Programs > Turn Windows features on or off)
  • Applications from Microsoft Store
    • Windows Terminal
    • Ubuntu 18.04 LTS (Launch it once, to really install it)
  • Applications
    • VS Code (will auto detect WSL. you can launch it "from" ubuntu with code .)
  • Other Applications
    • Firefox
    • TablePlus
    • Slack
    • Dropbox
    • Google Drive File Stream
    • 1password
    • Mailbird

On Ubuntu

  • sudo apt-get update

  • sudo apt-get install python3-pip python3-dev libpq-dev virtualenv libcairo2-dev libpango1.0-0 libxml2-dev libxslt1-dev libffi-dev libssl-dev openssl python-openssl postgresql postgresql-contrib redis

  • sudo apt-get install nginx curl vim git ufw gettext nodejs zsh chromium-browser

  • https://github.com/ohmyzsh/ohmyzsh

  • Install (the other) yarn

    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
    sudo apt-get update && sudo apt-get install yarn
    
  • Create a new or add your SSH key(s) to ~/.ssh/... (see https://medium.com/risan/upgrade-your-ssh-key-to-ed25519-c6e8d60d3c54)

  • Create a new postgres user with a password (or just change the password of the postgres user), this may help https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04 and start it with sudo service postgresql start (WSL doesn't support systemctrl)

  • scss-lint:

    • sudo apt install ruby-full
    • sudo gem install scss_lint

On Ubuntu 20, older python and older node

  • sudo add-apt-repository ppa:deadsnakes/ppa
  • sudo apt update
  • sudo apt install python3.6 python3.6-dev
  • virtualenv -p $(which python3.6) env
  • source env/bin/activate
  • pip install -e git+https://github.com/ekalinin/nodeenv.git#egg=nodeenv
  • nodeenv -p --node=8.10.0 (-p to install it into the current activated virtual env)

Python project

  • Clone your project
  • Create env virtualenv -p $(which python3) env (or )
  • pip install -r REQUIREMENTS_LOCAL
  • yarn
  • gulp build
  • and so on, depending on the project obviously, read the README. e.g. don't forget stuff like ln -s ../../pre-commit .git/hooks/pre-commit

VS Code

  • Extensions on WSL
    • Python (chose flake8 linter)
    • ESLint
    • scss-lint
    • gettext
    • Django
    • Close HTML/XML tag (alt+.)
  • Extensions local
    • Remote - WSL

Work

  • sudo service postgresql start
  • sudo service redis-server start
  • add_ssh_keys
  • ffw

Personal stuff

export ZSH="/home/sspross/.oh-my-zsh"
ZSH_THEME="gallois"
plugins=(git django fabric)
source $ZSH/oh-my-zsh.sh
export LANG=en_US.UTF-8
alias deletemergedbranches='git branch --merged | grep -v \* | xargs git branch -D && git fetch -p'
alias ffw='cd ~/projects/flatfox-website/ && source env/bin/activate'
alias po_to_windows='rsync -rv src/locale /mnt/c/Users/silva/Transfer --exclude="*.mo"'
alias po_from_windows='rsync -rv /mnt/c/Users/silva/Transfer/locale src'
# Start a splitted tmux session with everything ready for working on ffw
alias tmuxffw="tmux new-session \; \
send-keys 'ffw && add_ssh_keys' C-m \; \
split-window -v \; send-keys 'ffw && sudo service postgresql start && sudo service redis-server start && src/manage.py runserver' C-m \; \
split-window -v \; send-keys 'ffw && gulp webpack-server' C-m \;"
function add_ssh_keys() {
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519
}
export PGUSER=sspross
export PGPASSWORD=sspross
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment