For 2FA, Two-Factor Authentication, we install Google Authenticator on phone.
I tried oathtool, which gives the same code as Google Authenticator, as expected.
Here are the steps:
To get oathtool, OATH one-time password tool, to my Ubuntu:
$ sudo apt install oathtool gpgv2
To get the secret key from Google:
go to myaccount.google.com, in 2-Step Verification section.
It looks like this: 5j6bpmmhulttoktetk6yidf3xwua0000
Verification, in a 30 seconds time window:
Go to Google Authenticator and record the code, 460273 in my case.
Quickly on Ubuntu, run this command:
$ oathtool –verbose –totp –base32 “5j6bpmmhulttoktetk6yidf3xwua0000”
Hex secret: ea7c17b187a2e7372a649abd840cbbbd00000000
Digits: 6
Window size: 0
Step size (seconds): 30
Start time: 1970-01-01 00:00:00 UTC (0)
Current time: 2019-05-20 00:45:15 UTC (1558313115)
Counter: 0x318995A (51943770)
As seen here, 460273 matches the code from Google Authenticator.



Debug Python with VsCode

Visual Studio Code debugs Python. Here are the steps on Windows 10.
Create a folder with a .py file in it, e.g. Rio\proj\python\caller.py
Run code.exe, open the folder Rio\proj\python
Install extension: ms-python.python, which is the Python extension for VsCode from Microsoft.
Install pathon:
https://www.python.org/downloads python-3.7.3.exe 32bit 24M
which installs to C:\Users\rio\AppData\Local\Programs\Python\Python37-32\python.exe
Add config: click Debug then Add config, which creates S:\Rio\proj\python\.vscode\launch.json
Choose interpreter:
From Command Palette, type: Python: Select Interpreter
The installed python should be listed there, and click it.
Debug: open caller.py, set break point, hit the debug icon, they hit the green arrow in the tool bar.
execution should stop and variables can be inspected by mouse over.VsCodePy

Debug JS with VsCode

VsCode can debug JavaScript so that we can set break point and inspect values, instead of console.log

Here are the steps.
I use VsCode v1.30, Chrome v61, Windows 10.
VsCode is downloaded as zip file from code.visualstudio.com/download, no setup.exe
Run Code.exe and install MS Debugger for Chrome extension 4.11.3 there..
Create a VsCode project file: js.code-workspace, which tells where the .js .htm files are.
Create a launch file by click debug icon – gear icon.
Restart code.exe to have chrome listed in extension. Click it.
.\.vscode\launch.json which tells what browser and and the URL to run
e.g. http://localhost/VsCode/test.htm
Click debug button, or F5. code.exe launches chrome.
Break points can be set.
Variables can be checked by mouse over or in watch window.

Sample code can be downloaded here: http://riowing.net/p/VsCode.zip


Google Plus takeout to static html

Google Plus shutdown earlier April 2019, and I downloaded by Google takeout tools.
Each post becomes a static html page in the takeout, which needs conversion.
I wrote a python tool to convert one year of posts into a single page. Totally hundreds of posts from the last 6 years.
A “Read More” button was added so that it shows a few posts initially, and show all when button clicked.
It was done by Python and Javascript with no framework.
I tried ghost, the publishing platform based on Node.js, but felt it was a overkill.

Tools used:

Ghost: Ghost v2.14.1, requires Node.js version 10. default port 2368 and bind only to locahost in config.development.json.
expose to internet by nginx proxy in proxy_pass;
Python to parse Google Plus Takeout files, modules used by main.py:
html.parser, html.entities, ntpath since it’s on Windows 10, re to extract Youtube ID.
The JavaScript Read More button:
reorder the posts in reverse chronological order by document.body.childNodes
hide the earlier posts by putting them into a <span> and swap between .style.display = “none” .style.display = “inline”

Here is a sample page converted from google takeout, most postings in Chinese: