I am one of those people who function better by writing things down. One day, I realized that most of my notes don’t have to be private, so here they are - my second brain. Be warned that, if you stumble upon something here that doesn’t make sense to you, it isn’t meant to!
Install and Run Python Applications in isolated environments - kind of like brew for Python applications.
Install pipx: python -m pip install --user pipx Upgrade: python -m pip install --user pipx Install application using pipx: pipx install youtube-dl Run without installing: pipx run pycowsay moo. (Here, moo is the argument to the pycowsay application.)
Manage multiple versions of Python:
Install pyenv: Mac: brew install pyenv Others: curl https://pyenv.run | zsh Install a particular Python version: pyenv install 3.6 Set a particular Python version in shell: pyenv shell 3.6.9. (python --version should now show this new version - no need to use python3 to create virualenv etc.) After this, create virtualenv and open project in PyCharm. Set globally: pyenv global 3.8.0 List all installed via pyenv: pyenv versions Unset: pyenv shell --unset Troubleshooting:
...
Install: python -m pip install --user virtualenv Create env: python -m venv env. (Replace venv with virtualenv for python2.) Start: source env/bin/activate Check Python: which python Run pip: pip install -r requirements.txt Resolve dependencies: pip install .. (Avoid calling setup.py directly.) Close: deactivate
Install: Mac: brew install python3 Use Pyenv to manage multiple Python versions on one machine. Use Virtualenv to manage dependencies for a given project. (Don’t install dependencies globally.) Pip for dependency management. Use Pipx to install and Run Python Applications in isolated environments.
The ~(tilde) and ^(caret) symbols are used to point to a position relative to a specific commit. The symbols are used together with a commit reference, typically HEAD or a commit hash.
<n> refers to the <n>th grandparent. HEAD1 refers to the commit’s first parent. HEAD~2 refers to the first parent of the commit’s first parent.
^<n> refers to the the <n>th parent. HEAD^1 refers to the commit’s first parent. HEAD^2 refers to the commit’s second parent. A commit can have two parents in a merge commit.
...
Server Install RDP server on EC2:
sudo apt update sudo apt install -y ubuntu-desktop xrdp Configurations present at: /etc/xrdp/xrdp.ini
Install XFCE:
sudo apt install -y xfce4 xfce4-goodies echo xfce4-session >~/.xsession (Probably optional) Set a password for the ubuntu user: sudo passwd ubuntu.
Restart XDRP: sudo service xrdp status
Client Setup SSH port forwarding from laptop to EC2.
Using AutoSSH:
autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -i ~/.ssh/ec2-keypair-1 -NfL localhost:8889:localhost:3389 [email protected] Or the usual way:
...
Setup:
sudo apt-get install abcde flac echo "OUTPUTDIR=/media/unencrypted_drive/SharedFolder/Music" >> ~/.abcde.conf echo "OUTPUTTYPE=flac" >> ~/.abcde.conf echo "EJECTCD=y" >> ~/.abcde.conf Note:
All options are present in /etc/abcde.conf file. Then just run:
abcde
rbenv Use rbenv to manage multiple Ruby versions.
Install new Ruby version: rbenv install 1.9.3-p551 Ruby is installed in a location like: ~/.rbenv/versions/1.9.3-p551/bin/ruby. Check installed versions: rbenv versions
Fire and forget:
scp -i ~/.ssh/key.pem file.sh ec2-user@$PUBLIC_IP:~ ssh -i ~/.ssh/key.pem ec2-user@$PUBLIC_IP " \ sh -c 'nohup ~/file.sh > /dev/null 2>&1 &' \ " Or:
ssh -i ~/.ssh/key.pem ec2-user@$PUBLIC_IP "sudo shutdown now > /dev/null 2>&1 &"
Next time: Take a car! Don’t stay near Mission Beach. Clubs in Gaslamp Quarter close at 2. Don’t:
Sea World - expensive. Avoid.