Menu

linux/

Ansible: List all vars of the host

ansible stag-s4 -m debug -a "var=hostvars[inventory_hostname]"
· 18 Jan 2022

Change DNS nameservers using NetworkManager

sudo nmcli connection modify <connection name> ipv4.dns "1.1.1.1 8.8.8.8"

Apply changes:

sudo nmcli dev reapply <interface>
· 30 Dec 2021

How to reload the connection with NetworkManager

Reload interface configuration:

sudo nmcli connection reload

This command will ONLY make NetworkManager aware of new configuration changes. To apply the new changes, run the following command:

sudo nmcli dev reapply <interface>
· 30 Dec 2021

Wait until DNS propagates

until [[ -n $(dig new.mydomain.com A +short @1.1.1.1) ]]; do echo "waiting..." && sleep 5; done

-n flag stands for non-empty string

· 22 Dec 2021

Install module (collection) in Ansible

ansible-galaxy collection install containers.podman
· 21 Dec 2021

Rebase git branch on a different branch

git rebase --onto new_base old_base
· 20 Dec 2021

Log Varnish hash data

When starting Varnish, add -p vsl_mask=+Hash argument to the command. Print varnish logs with this command:

sudo varnishlog -n /opt/varnish -q 'ReqURL ~ "my_request"'
· 17 Dec 2021

lxd: delete all images

Delete all images which contain build-cache in their name:

lxc image list -c l --format csv | grep build-cache | xargs -I % lxc image delete %
· 2 Dec 2021

Improve Bluetooth headset audio quality

In order to enable mic on a bluetooth headphones, you need to change device configuration to Headset Head Unit in Settings > Sound menu. However, if you do so, the audio quality of the headphones will be quite bad.

Pipewire introduced support for the mSBC codec. This codec allows your headphones to enable microphone and still have okay-ish audio quality.

mSBC codec is disabled by default. To enable it, create ~/.config/pipewire/media-session.d/bluez-monitor.conf file with the following content:

properties = {
    bluez5.msbc-support = true
}

Restart Pipewire:

systemctl --user restart pipewire.service

HSP/HFP, codec mSBC option should be available in Settings > Sound menu

· 30 Nov 2021

Merge repositories and keep history

There is a special command git-subtree to merge / split repositories. It is not installed as a part of git package:

sudo dnf install git-subtree

The command to merge repository jsnjack/X to subfolder myfolder/new at branch master:

git subtree add -P myfolder/new git@github.com:jsnjack/X.git master
· 25 Nov 2021