Skip to content

Cheat Sheet

Rachael Brady edited this page Nov 22, 2024 · 1 revision

Cheat Sheet

WSL Windows Subsystem for Linux

WSL current directory

WSL WSL

Vim

VIM

  • Start Typing
i = start typing
  • Saving file
esc + : x = save and exit file

GitHub

GitHub

Git repository on local computer

Create SSH Key. Passphrass less by hitting enter 2x.

ssh-keygen

id_rsa is the private key. You will only need to move this if doing a new install/new computer.

/Users/Rachael/.ssh/id_rsa

cat public key to paste into GitHub.

cat /Users/rachael/.ssh/id_rsa.pub

Add public key into Github.com Settings

Finally git clone Molly Match site.

git clone [email protected]:rachyrachyrach/mollymatch_site.git

Staging

Git won't automatically add files when using staging.

Add files to Git

git add filename
git status

This will show green text for files that need to be uploaded.

commit

git commit -v

push

git push origin master

Check files, including hidden files by:

ls -alR

Don't upload the .venv to github. Make the .gitignore file. This will be useful to for keeping your passwords locally.

rebase

Get on the branch you want to update. This example shows us creating an "add_auth" branch.

git checkout add_auth

git rebase --interactive origin/master 

git log 

git status 

git checkout -b new-branch-name

django

django

Run Django

This allows you to check the website locally in broswer: 127.0.0.1:8000

.manage.py runserver

Exit .venv

Exit out of your python virutal environment

deactivate

Postgres

source .venv/bin/activate
sudo service postgresql start
python manage.py runserver

VS Code

Visual Studio Code

Can run .venv in VS Code after "Play" the file.

Pushing commits in VS Code

Set up GitHub user

Set up user for GitHub. Don't need to be in virtual environment for this.

git config --global user

Run VS Code through WSL

code

Generate SSH Key

  1. Generate SSH key for Git/Github mollymatch_site
ssh-keygen
cat .ssh/id_rsa.pub which is inside similar path /Users/yourname/.ssh/id_rsa.pub

Your key will look similar to this:

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDm39w6o4EZa6aAyNFiiuuKASgiDomPox3i0xe/1On/xtk2o3hkmTjSOmgb85+zoDy69eHxLJy9p3Umsc5G5bmPX5RQDoBlGOwEV4/vDiyH3SpIX833PcdHBXkLFPWY/E7ENUzyQMF8lqRI8XltSjFfoZc/RsR98r8EFj3LKlKiw/P313Kb2i7mBdupCViaDQL/N6id413s1CZ85eCNasgiUJUkQO4ERuZ1sSqhzxanVY+opgyu0C+SGDTOkNQSg1XhGwRl8SJzzvziI0Md/VgsBK9s6dZsgAMmI0qDtLlBU5NZngHMKLv/aIZUc2u9xjjj6ycNf9YFGLdIYCyFcY5fBvRtE3LZG31I2Cctqt4D2Lwv3QCljoCRMoSxkCBZnV09hbkUWBhRlXEctwT7+jKmmsGsmKVHl8KMMYC9u1B/vpHf2+ICpE6v0wBRwrqvu3Z/c0YHkkyqdHtKDpR0ZEnovrjh6jZjZrQ1ddABEFEOG6+eKtABhYZv3lsPJJUM918= [email protected]

SSH Key in GitHub

Paste this key into your Github account: https://github.com/settings/keys New SSH Key

Misc.

Looking for a word in all the files? Try grep

grep -R "get_current_profile" *

Example

(.venv) rachael@Rachaels-MacBook-Pro handcash-connect-sdk-python % grep -R "get_current_profile" *
handcash_connect_sdk/profile.py:    def get_current_profile(self) -> UserProfile:
handcash_connect_sdk/profile.py:        return UserProfile(**self._handcash_connect_service.get_current_profile())
Binary file handcash_connect_sdk/tests/unit/__pycache__/test_http_request_factory.cpython-39.pyc matches
handcash_connect_sdk/tests/unit/test_http_request_factory.py:def test_get_current_profile_request(http_request_factory: HttpRequestFactory):
handcash_connect_sdk/tests/unit/test_http_request_factory.py:    method, url, body, headers = http_request_factory.get_current_profile_request()
handcash_connect_sdk/tests/integration/test_profile.py:    def test_get_current_profile(self):
handcash_connect_sdk/tests/integration/test_profile.py:        user_profile = self.profile.get_current_profile()
Binary file handcash_connect_sdk/tests/integration/__pycache__/test_handcash_cloud_account.cpython-39.pyc matches
Binary file handcash_connect_sdk/tests/integration/__pycache__/test_profile.cpython-39.pyc matches
handcash_connect_sdk/tests/integration/test_handcash_cloud_account.py:    handcash_cloud_account.profile.get_current_profile()
Binary file handcash_connect_sdk/__pycache__/profile.cpython-39.pyc matches
handcash_connect_sdk/api/http_request_factory.py:    def get_current_profile_request(self):
Binary file handcash_connect_sdk/api/__pycache__/http_request_factory.cpython-39.pyc matches
Binary file handcash_connect_sdk/api/__pycache__/handcash_connect_service.cpython-39.pyc matches
handcash_connect_sdk/api/handcash_connect_service.py:    def get_current_profile(self):
handcash_connect_sdk/api/handcash_connect_service.py:            *self._http_request_factory.get_current_profile_request())
(.venv) rachael@Rachaels-MacBook-Pro handcash-connect-sdk-python %