Most of my day mainly goes into family time, workouts, house chores, entertainment (movies, shows, cricket etc.), hobby projects, sleep, other (personal hiegene, breakfast, lunch, dinner) and reading news, blogs/audiobooks/videos. Since I cannot write about my family time, personal life, workouts, and house chores, for your benefit :), I can tell you what I am reading, listening, watching, and working on a daily basis. So here is what happened yesterday (remember it is not comprehensive; you are seeing what I remember to record). Also note that I spend way more time on family than work (unlike when I was still working). So what I do on a day to day basis may seem a lot less than what most of you do :).


Blogs I Read Today

Not interested in disclosing.

Audio I Listened to Today


Videos I Watched Today




Hobby Projects

Wrote yesterday’s blog.


Some personal work I prefer not to disclose.


If you remember, I use EWW (Elkowars Wacky Widgets) to display CPU usage and temperatures of various components on my laptop. There has been one persistent problem I have been trying to solve which was the issue with the keys for EWW state changing every once in a while.


For example, if I have a widget that monitors the wifi temperature like the following, it would sometimes show the temperature correctly, but some other times, like after coming back from standby or a restart it will not work.

(defwidget wifi-temp []
  (temp-module :label "wifi" :key "MT7921_PHY0_TEMP1" :warn 45 :critical 50)
)


The problem is that this issue is not consistent. Sometimes it works for several days and sometimes fail 10 times in a day. Eventually I took some time today to figure out the problem. It seems like the keys are changing once in a while. For instance, the key MT7921_PHY0_TEMP1 in the above widget will change to something like MT7921_PHY1_TEMP1. You can find the keys by running eww state:

EWW_TEMPS: {"AMDGPU_EDGE":"50","K10TEMP_TCTL":"59.625","MT7921_PHY20_TEMP1":"50","NVME_COMPOSITE_WDC_PC_SN530_SDBPNPZ-512G-1114_TEMP1":"43.85"}
EWW_CPU: {"avg":3.3018605709075928,"cores":[{"core":"cpu0","freq":4056,"usage":3},{"core":"cpu1","freq":4056,"usage":2},{"core":"cpu2","freq":2069,"usage":3},{"core":"cpu3","freq":4056,"usage":3},{"core":"cpu4","freq":2005,"usage":3},{"core":"cpu5","freq":4056,"usage":1},{"core":"cpu6","freq":4056,"usage":2},{"core":"cpu7","freq":4056,"usage":1},{"core":"cpu8","freq":4056,"usage":2},{"core":"cpu9","freq":4056,"usage":6},{"core":"cpu10","freq":2108,"usage":3},{"core":"cpu11","freq":2072,"usage":2}]}


I wanted to use a regex for the key so that no matter what the suffix changes to, it still works. So I asked gemini (well I asked google, which triggers gemini) and it gave me an elegant solution which was to use jq.

jq(EWW_TEMPS, 'to_entries | map(select(.key | test(\"MT7921_PHY\"))) | .[0].key')


There is one problem however, the key contains double quotes. I asked gemini to give me a solution that does not have double quotes in the output. It could not give a proper solution. Well, my prompting skills are not that great, and I did not want to spend too much time explaining what I wanted it to do when I can come up with a solution in 2 mins. So eventually I decided to write myself and used the replace function.

(temp-module :label "wifi" :key "${replace(jq(EWW_TEMPS, 'to_entries | map(select(.key | test(\"MT7921_PHY\"))) | .[0].key'), '"', '')}" :warn 45 :critical 50)


Now the widget is very stable. I decided to do the same fix on my daughter’s laptop (which was my old laptop, that I gave it her to use).

(defwidget wifi-temp []
  (temp-module :label "wifi" :key "${replace(jq(EWW_TEMPS, 'to_entries | map(select(.key | test(\"IWLWIFI\"))) | .[0].key'), '"', '')}" :warn 45 :critical 50)
)

(defwidget acpi-temp []
  (temp-module :label "acpi" :key "${replace(jq(EWW_TEMPS, 'to_entries | map(select(.key | test(\"ACPITZ\"))) | .[0].key'), '"', '')}" :warn 50 :critical 70)
)

(defwidget mb-temp []
  (temp-module :label "mb" :key "${replace(jq(EWW_TEMPS, 'to_entries | map(select(.key | test(\"PCH_SKYLAKE\"))) | .[0].key'), '"', '')}" :warn 45 :critical 50)
)


That is all for the day!