Install fonts in Linux
Copy the fonts files to ~/.local/share/fonts/
. Then, run fc-cache
to rebuild fonts cache.
fc-cache -fv
Copy the fonts files to ~/.local/share/fonts/
. Then, run fc-cache
to rebuild fonts cache.
fc-cache -fv
Frequently used commands for Git submodules.
TO add the reference to another git project as a submodule:
git submodule add $url $path
git submodule update --init --recursive
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
With -b $branch
option
git submodule add -b $branch $url $path
Or set-branch -b $branch
if you already have added a submodule
git submodule set-branch -b $branch $path
From a stackOverflow post and Git docs
git submodule update --remote --merge
For automated updates by bots, see automatic dependency update.
From Git docs
# Remove submodule from config
git submodule deinit $path
# Delete submodule tracking data
git rm <submodule path> && git commit
# Complete removal
rm -rf $GIT_DIR/modules/$name/
To display frequencies of all CPU cores every second:
watch -n1 lscpu --all --extended
ssh-keygen -t ed25519 -C "your_email@example.com"
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_ed25519
is the private key. Protect it at all costs.~/.ssh/id_ed25519.pub
is 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.
Edit ~/.ssh/config
mkdir -p ~/.ssh
touch ~/.ssh/config
chmod 600 ~/.ssh/config
nano ~/.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
According to 📖 Github docs, add the SSH key here
~/.ssh/id_ed25519.pub
to the key field.Add SSH key
green button. If prompted, confirm your GitHub password.Add the SSH key here
~/.ssh/id_ed25519.pub
to the key field.Add key
button.GitHub:
ssh -vT git@github.com
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:
ssh -vT git@gitlab.com
Accept its fingerprint if prompted.
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.
timedatectl set-local-rtc 1
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.
How to recover Nautilus (File manager in Gnome) places folders.
Use pathlib
to read and tomllib
to parse the file. (requires Python >= 3.11)
Arch Wiki: environment variables
/etc/profile
is sourced by all POSIX-compatible shells upon login./etc/profile.d/
directory will also be read.~/.profile
or ~/.bash_profile
for login bash instances.~/.bashrc
for every interactive bash instance.~/.zshenv
for environment variables in all zsh instances.~/.zprofile
for every login zsh instance.~/.zshrc
for every interactive zsh instance.Note
zsh does not source ~/.profile
by default because of the difference between bash and zsh syntaxes. You can add this line to ~/.zprofile
or ~/.zshenv
to make zsh shells read `~/.profile correctly.
skip_global_compinit=1
test -r ${HOME}/.profile && emulate sh -c 'source ${HOME}/.profile'
~/.xinitrc
is sourced by startx
.~/.xprofile
is sourced by display managers (e.g., GDM, SDDM)~/.config/environment.d/*.conf
: sourced by systemd
. Also, they are used in Wayland sessions where xinitrc
and xprofile
files are not available.Environment variables in Powershell
Variables created by set
are bound to the current session and not persistent.
$Env:FOO = "example"
$Env:FOO
[Environment]::SetEnvironmentVariable('KEY', 'VAL', 'Machine')
SETX KEY VAL
Git filter-repo is a filter-branch
replacement for rewriting history written in a single-file python script.
To wipe large binary files entirely:
git filter-repo --strip-blobs-bigger-than 100M
Bonus: Remove sensitive content
git filter-repo --use-base-name --path id_dsa --path id_rsa --invert-paths
git filter-repo --replace-text passwords.txt