Skip to content

Instantly share code, notes, and snippets.

@gtirloni
gtirloni / chrome_wayland.md
Created February 13, 2024 15:14
Fedora 39 + Chrome 121 + Wayland

Chrome + Wayland

After switching to Wayland (with an Intel iGPU on Fedora 39), I started experiencing extreme lag in Chrome.

Here is a workaround:

  1. Go to chrome://flags
  2. Search for "ozone" or "wayland"
  3. Set "Preferred Ozone platform" to "auto"
  4. Relaunch
@gtirloni
gtirloni / nuvoton.md
Last active January 31, 2024 14:00
lm_sensors and Nuvoton chips

lm_sensors and Nuvoton chips

My ASUS B760M motherboard and many others have a Nuvoton Super I/O chip used for controlling fans, monitoring temperature and other tasks.

Some of the temperature readings that the chip provides are not connected to any physical sensors. This caused bad readings, like reported by lm_sensors here:

$ sensors nct6798-*
nct6798-isa-0290
Adapter: ISA adapter
@gtirloni
gtirloni / README.md
Last active August 30, 2023 19:14
Flexible per-alert silences in Grafana

Flexible per-alert silences in Grafana

Overview

Certain expected behaviors in the infrastructure can cause alerts to fire unnecessarily, generating noise and contributing to alert fatigue.

For example, database backups can increase the number of disk operations beyond what is expected during business hours but they don't cause issues that require human actions because they usually run outside business hours.

If these events happen on specific time periods, they can be ignored programmatically.

@gtirloni
gtirloni / README.md
Last active August 17, 2023 12:45
Google Chrome work profiles on Linux

Work profile with Google Chrome on Linux (GNOME)

The goal is to open a different profile for work-related URLs opened anywhere on the desktop.

Install Steps

  1. Copy default-browser.sh to $HOME/bin (or somewhere else in your PATH)
  2. Copy default-browser.desktop to $HOME/.local/share/applications
  3. Update $HOME/.config/mimeapps.list with proper values (or create file from scratch)
  4. Go to Settings > Default Applications and configure "Default Browser" for Web
@gtirloni
gtirloni / git-blame-ignore.md
Last active July 20, 2023 13:23
git-blame ignore major formatting commits

git-blame shows what revision and author last modified each line of a file.

$ echo "this is a test" > test.txt
$ git add test.txt
$ git commit -m "first commit"
$ git blame test.txt
^d12054e (John Doe 2023-07-20 10:08:32 -0300 1) this is a test
@gtirloni
gtirloni / mount-ec2-snapshot-same-server.md
Created June 13, 2023 12:05
mount-ec2-snapshot-same-server
  1. Locate the snapshot in EC2 > Snapshots
  2. Actions > Create volume from snapshot
  3. Locate the new volume in EC2 > Volumes
  4. Actions > Attach volume
  5. Confirm volume is attached to instance (ls -l /dev/nvme1*)
  6. Confirm volume has same UUID as the root disk (blkid)
  7. Change volume UUID to avoid conflicts (uuidgen && xfs_admin -U GENERATED_UUID_HERE /dev/nvme1n1p1)
  8. Confirm UUID was changed (blkdid)
  9. Mount filesystem (mount -t xfs /dev/nvme1n1p1 /mnt)
@gtirloni
gtirloni / jupyter-lab.service
Last active May 6, 2023 14:18
Start Jupyter-lab automatically
[Unit]
Description=JupyterLab
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/bin/jupyter lab --no-browser
Restart=on-failure
RestartSec=7
RestartPreventExitStatus=3
@gtirloni
gtirloni / wireplumber.md
Last active April 26, 2023 15:07
How to disable audio devices with Pipewire

Find your devices

$ pactl list short

Create the Wireplumber rule to disable the device

$ mkdir -p $HOME/.config/wireplumber/main.lua.d
@gtirloni
gtirloni / known_hosts.yml
Created January 9, 2023 18:05
known_hosts.yml
- hosts: all
gather_facts: false
become: false
tasks:
- name: Populate ~/.ssh/known_hosts
delegate_to: localhost
known_hosts:
key: "{{ lookup('pipe', 'ssh-keyscan ' + inventory_hostname + ' 2>/dev/null') }}"
name: "{{ inventory_hostname }}"
@gtirloni
gtirloni / ansible_version.md
Last active July 28, 2022 00:01
ansible_version.py

ansible_version.py

This is a plugin that verifies if the Ansible version meets the version requirements.

You can use the same range identifiers from Ansible Galaxy, separate by commas:

*: The most recent version. This is the default.
!=: Not equal to the version specified.
==: Exactly the version specified.