Skip to content

Instantly share code, notes, and snippets.

@meowtochondria
meowtochondria / wezterm_single_instance.sh
Created August 12, 2024 17:32
Launch or bring wezterm into focus
#!/bin/sh
test -z "$WEZTERM_CONFIG_FILE" && test -f /home/dev/src/scripts/wezterm.lua && export WEZTERM_CONFIG_FILE=/home/dev/src/scripts/wezterm.lua
DESKTOP_FILE='/usr/share/applications/org.wezfurlong.wezterm.desktop'
# get binary name by looking at 'Exec' value in .desktop file.
BIN=$(grep -P '^Exec=' $DESKTOP_FILE | cut -f 2 -d '=' |cut -f 1 -d ' ')
# wezterm does put its name in window title. so wmctrl is not able to find it.
@meowtochondria
meowtochondria / buggy_acpi_interrupts.md
Created April 25, 2022 20:47
CPU fan running hot with no real load

My linux laptop has had its fan constantly running every time i unplug and plug in my dock. It used to happen when my wired network port was not detected, but today it was detected but the fan was still running hot. So I spent some time and figured out a workaround.

Issue: ACPI keeps firing General Purpose Events which kernel does not really know how to handle. According to internet, this usually happens due a bug in BIOS or hardware.

Fingerprints:

  1. Fan is spinning a lot even with no apparent load.
  2. CPU usage is not too high. Internet had CPU usage quite high... like 90%. For me, it was just 1%
  3. kworker/??:??kacpi_notify is taking up 1% CPU.
  4. systemd-udevd process is churning in your fav process monitor. I used KDE's System Monitor utility.
@meowtochondria
meowtochondria / calibri.sh
Last active September 20, 2022 20:48
Fix Calibri rendering in Ubuntu
mkdir $HOME/.config/fontconfig/conf.d
echo -e "<fontconfig>\n <match target=\"font\">\n <test compare=\"contains\" name=\"family\">\n <string>Calibri</string>\n </test>\n <edit mode=\"assign\" name=\"embeddedbitmap\">\n <bool>false</bool>\n </edit>\n </match>\n</fontconfig>\n" > $HOME/.config/fontconfig/conf.d/calibri.conf
@meowtochondria
meowtochondria / lego_installer.sh
Created October 8, 2019 00:53
Helper to install https://github.com/go-acme/lego on shared hosting providers.
#!/bin/bash
###########################################
# Some initializations. #
###########################################
project='go-acme'
product='lego'
pkg_version='latest'
isDebug=false
release_link="https://api.github.com/repos/$project/$product/releases"