Portal¶
Install fonts in Linux
Copy the fonts files to ~/.local/share/fonts/. Then, run fc-cache to rebuild fonts cache.
Git submodule
Frequently used commands for Git submodules.
Add a submodule
TO add the reference to another git project as a submodule:
Alternatively, you can use GUI tools like or GitHub desktop. They download and initiate submodules automatically.
Add you will see the file .gitmodules with information about the submodule(s). For instance,
[submodule "themes/DoIt"]
path = themes/DoIt
url = https://github.com/HEIGE-PCloud/DoIt.git
Track a specific branch in the submodule
With -b $branch option
Or set-branch -b $branch if you already have added a submodule
Update all Git submodules to the latest commit
From a stackOverflow post and Git docs
For automated updates by bots, see automatic dependency update.
Remove a submodule
From Git docs
Linux CPU frequency
See current CPU frequency
To display frequencies of all CPU cores every second:
SSH login to GitHub and GitLab
Generate a pair of SSH keys
The SSH agent will ask you to enter a location to save the keys. e.g. /home/user/.ssh/id_ed25519. Passphrase is optional.
Then there will be two SSH key files:
~/.ssh/id_ed25519is the private key. Protect it at all costs.~/.ssh/id_ed25519.pubis the public key.
Using different keys for GitHub and GitLab access is more secure. However, the same pair of keys is used for this demonstration purposes.
Add remote to the SSH settings
Edit ~/.ssh/config
Add the following content to set the private key as the IdentityFile.
Host GitHub
HostName github.com
IdentityFile ~/.ssh/id_ed25519
Host GitLab
HostName gitlab.com
IdentityFile ~/.ssh/id_ed25519
Add the SSH key to your GitHub account
According to 📖 Github docs, add the SSH key here
- Paste the content of the public key,
~/.ssh/id_ed25519.pubto the key field. - Add a descriptive label for the new key in the "Title" field.
- Finally, click the
Add SSH keygreen button. If prompted, confirm your GitHub password.
Add the SSH key to your GitLab account
Add the SSH key here
- Paste the content of the public key,
~/.ssh/id_ed25519.pubto the key field. - Add a descriptive label for the new key in the "Title" field.
- Select an expiration date.
- Finally, click the
Add keybutton.
Test your setup
GitHub:
Accept its fingerprint if prompted. If you see "Hi user! You've successfully authenticated, but GitHub does not provide shell access" that means login is successful.
GitLab:
Accept its fingerprint if prompted.
Use local time in Linux
When dual-booting Linux and Windows,it might be better to set the clock to the local time zone in Linux1 to in sync with Windows settings.
Strip Jupyter Notebook Output
Jupyter notebooks without multimedia outputs are more friendly to source control since git is not good at comparing binary data (e.g., plots, pictures, videos) in jupyter notebooks. And they tend to bloat the size of git repositories.
Recover Nautilus places folders
How to recover Nautilus (File manager in Gnome) places folders.
[Python] Read TOML file in one line
Use pathlib to read and tomllib to parse the file. (requires Python >= 3.11)