Saturday, August 8, 2020

Install Python 3 virtualenv on Ubuntu (Goolge Cloud)

This one is workable for me.

# Step 1: Update your repositories
$ sudo apt-get update
 
# Step 2: Install pip for Python 3
$ sudo apt-get python3-dev
$ sudo apt install python3-pip
 
# Step 3: Use pip to install virtualenv (no sudo)
$ pip3 install virtualenv
 
# Step 4: Create your Python 3 virtual environment
$ python3 -m virtualenv -p python3 env3
 
# Step 5: Activate the new Python 3 environment.
$ source env3/bin/activate
 
# you can make sure you are now working with Python 3
$ python --version


Saturday, August 1, 2020

Solve Google Chrome "Aw Snap! STATUS_INVALID_IMAGE_HASH" crashes

  1. Open regedit application
  2. Create HKLM\Software\Policies\Google\Chrome, it does not exist.
  3. Create a new  "DWORD 32 bit value" named "RendererCodeIntegrityEnabled"
  4. Set the value to 0x00000000(0)
  5. Reopen Chrome

Thursday, July 16, 2020

Set up Google Cloud VM

Setup up ssh

https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys

Note:
$ ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]


Set [USERNAME] for the same user.

Change root password

$ sudo passwd


Change user password

$ sudo passwd [USERNAME]

Install zsh

https://ohmyz.sh/

Graphical user interface (GUI) for Google Compute Engine instance

https://medium.com/google-cloud/linux-gui-on-the-google-cloud-platform-800719ab27c5
https://medium.com/google-cloud/graphical-user-interface-gui-for-google-compute-engine-instance-78fccda09e5c
https://help.realvnc.com/hc/en-us/articles/360003474792-Why-does-VNC-Server-in-Virtual-Mode-on-Linux-appear-to-hang-show-a-gray-screen-or-not-start-at-all-#using-vnc-5-x-or-vnc-connect-6-0-6-1-or-on-a-different-version-of-linux--0-1

Steps:
1. sudo apt install xfce xfce4-goodies vnc4server
2. change .vnc/xstartup to

#!/bin/sh
DESKTOP_SESSION=xfce
export DESKTOP_SESSION
startxfce4
vncserver-virtual -kill $DISPLAY


3. start vncserver
$ vncserver

4. stop vncserver
$ vncserver -kill :1

5. set firewall on Google VM by adding a rule with tag "vnc-server": https://console.cloud.google.com/networking/firewalls/list?_ga=2.140666673.226794997.1594947656-1741100383.1594947656&project=covid-19-283520&folder=&organizationId=
6. add "vnc-server" in "Network tag" in the VM instance
7. On local machine, install RealVNC