Skip to content

Tips

Install fonts in Linux

Copy the fonts files to ~/.local/share/fonts/. Then, run fc-cache to rebuild fonts cache.

fc-cache -fv

Set CPU frequency

Changing the settings directly

From the Stackoverflow post

Query CPU options

grep . /sys/devices/system/cpu/cpu0/cpufreq/*

Set the maximum CPU frequency

echo 4400000 | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq

cpufrequtils

Install cpufrequtils

sudo apt install cpufrequtils

Set the maximum CPU frequency

sudo cpufreq-set -u 4Ghz

Recover Nautilus places folders

How to recover Nautilus (File manager in Gnome) places folders.

Check ~/.config/user-dirs.dirs and make sure the following entries exist and properly setup

.config/user-dirs.dirs
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

After saving the file, run the following command to reload Nautilus settings:

xdg-user-dirs-gtk-update

Python: Read TOML file in one line

Use pathlib to read and tomllib to parse the file. (requires Python >= 3.11)

For example, to extract Julia version from Manifest.toml

import tomllib; from pathlib import Path; print(tomllib.loads(Path("Manifest.toml").read_text())["julia_version"])

And it's easy to run in a bash shell or CI script.

python -c 'import tomllib; from pathlib import Path; print(tomllib.loads(Path("Manifest.toml").read_text())["julia_version"])'

Power limit for nvidia GPUs

You can make GPUs consume less (or more) power by setting the power limit.

Source: Puget systems

# Power limit to 300 Watt
sudo nvidia-smi -pl 300

To monitor GPU power draw:

nvidia-smi -q -d POWER -l 1 | grep "Power Draw"

Cancel old jobs in GitHub actions

The concurrency keyword ensures there is only one job running on the specified group. If there are older jobs running in the same group, you could cancel old jobs to save runner resources.

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

Github Action and Cirrus CI

Run Github actions after successful Cirrus CI runs using the check_suite trigger.

.github/workflows/cirrus.yml
on:
  check_suite:
    type: ['completed']

name: Continue after Cirrus CI Completes Successfully
jobs:
  continue:
    name: After Cirrus CI
    if: github.event.check_suite.app.name == 'Cirrus CI' &&  github.event.check_suite.conclusion == 'success'
    runs-on: ubuntu-latest
    steps:
    - name: Continue
      run: echo "Cirrus CI run is Completed"