Skip to content

Instantly share code, notes, and snippets.

@gtirloni
gtirloni / wsl-dropbox.md
Last active April 15, 2024 11:59
Windows WSL2 and Dropbox

This was only tested on Fedora 35 with systemd but should work on any WSL distribution that uses systemd.

Install the Dropbox headless client:

$ cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

Install the Dropbox manager script into your ~/bin folder:

@gtirloni
gtirloni / wsl-luks.md
Created May 2, 2022 12:44
Windows WSL2 and LUKS

If you have a LUKS-encrypted partition on another disk, it's easy to mount it inside WSL.

List your disks:

> wmic diskdrive list brief

Mount the whole disk inside WSL (using --bare so WSL doesn't attempt to mount it automatically):

@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