QEMU libvirt VM Migration/Backup…

Attempting to backup a VM was a mess – the Windows 11 activation was broken upon copying, so I got AI to help me code a migration script…

After a huge amount of my own time (largely because I am a cheap-ass and was attempting to do things locally on a Qwen 3.8 27B on an AMD 395+ Strix Halo w/128gB RAM), a huge amount of repetitions across free Google AI Mode (sucks) and free ChatGPT (good enough), I finally got a working script…

It took about a month, an hour or so on and off whenever I had “spare” time, with some 32 iterations before I had a script that didn’t have script errors and I was sure the logic and technicals were sound (yes, I ran through the code manually). Then another 4 iterations to address run-time issues and figure out what broke Windows 11 activation…

Have fun!

Auto Toggling Touchpad

I get irritated whenever my touchpad accidentally triggers when I am typing on the laptop keyboard, shifting focus and ending up typing on some other window or screen. The straw that broke the camel’s back was when the focus shifted from a password entry to a chat window and I ended up sending (part of) my password to someone…

With the help of Google’s AI mode and later ChatGPT (yes, I needed both to get things to finally work), I whipped up a solution based on AutoHotkey.

Total time:

  • design, redesign, code, testing + retesting: ~2 hours
  • Repo ReadMe.md documentation: 0.5 hours

Hopefully this helps someone.

Forcing the Reddit App Down Your Throat…

So, browsing Reddit on your mobile, usually from Google search results, is now an exercise in frustration – Reddit will freeze your screen and force you to jump to their app.

I do not like using the app. If I can use a normal browser to navigate, there is no valid technical reason I must use your app.

So, Fennec browser, complete with uBlock Origin, to the rescue (because Chrome just sucks)!

Add the following to the “My filters”:

! Remove Reddit mobile app wall popup
www.reddit.com##.rpl-bottom-sheet
www.reddit.com##+js(remove-class, rpl-scroll-lock, body, stay)
www.reddit.com##+js(remove-class, scroll-is-blocked, body, stay)
www.reddit.com##+js(prevent-addEventListener, touchmove)

Problem fixed.

Email OAuth2 Proxy

Microsoft Screws Their Users… Again…

 

Desktop Outlook Banned From Outlook.com and Hotmail.com POP3

Microsoft had stopped allowing users of their premium Outlook desktop product (versus the useless, neutered “Outlook” wannabe bloatware “Outlook for Windows” included force installed in Windows 11) to access their “free” @hotmail.com and @outlook.com emails via POP3 and SMTP (secured or not), forcing everyone to effectively use IMAP mode (links here and here, backup here).

Leaving discussions over any reasons (e.g. financial greed trying to force clueless desktop Outlook + “free” MS email-using people to pay for more storage) and the sheer stupidity of forcing this down full-fat, existing Outlook customers’ collective throats (against, say, everyone else like those using Thunderbird or other third-party email clients) aside, I had simply left this aside, relying on my trusty K-9 Mail on Android to access any emails on these “throw-away” accounts…

Unfortunately, there were a few emails (mainly shopping-related receipts) that I wanted to keep – so once again, I had to roll-up my sleeves and fix shit Microsoft breaks get things working…

Google search basically found me Email OAUTH2 Proxy nearly immediately… Attempts at simply using the Docker image did not go so smoothly, so I ended up using pipx and did a “bare metal” install..

Continue reading →

x11vnc Copy-and-Paste…

To prevent typos and OS line break-type kerfuffles, I typically copy files instead of copy-pasting any files’ contents across VNC sessions.

Somehow, I came across wanting to just copy-paste a file via a VNC session, which used to work ye long ago… But it just was not happening…

Diving into the ‘net for answers, I came across autocutsel… Although some places stated to use xstartup files, as I was using x11vnc, this was not possible, so I simply ended up creating a services file (with a dependency on the x11vnc service):

Continue reading →

CPanel Email Filters

As part of managing my own web presence, including a hosted email server with limited users (both in numbers and geography), I tend to try and cut large swathes of spam by simply “binning” any emails that have any association with specific TLDs, like .ru or .us or .cn– whereby I know that my users and I have no legitimate reason to receive any email coming from those TLDs or passing through servers using any such TLDs.

However, it came to pass that some ham were getting caught, but simply looking at the email headers was not helping. Using CPanel’s in-built testing tool was helpful in surfacing which of my rules was triggering the spam trap, but not exactly why (or what part of the email was triggering it).

The triggering rule looked like regex, so I immediately tried to hunt down converted/parsed file to try and copy the rule in converted regular expression form.

Attempting to poke at the ~/.cpanel/filter.yaml and ~/.cpanel/filter.cache and even the /etc/vfilters/<domain> did not turn up the regular expressions I was looking for.

In desperation, I took a quick look at the CPanel test tool results and decided to just copy the regex shown outright…

Unfortunately, pasting that regex directly into a regex test tool did not work…

Continue reading →

GNU getopt Needs A Helper

So, recently at work, I found myself knee deep in… scripts…

Most of my scripts had ugly positional parameters/arguments (you know, $1 was the value for this, $2 was the input for that)… So, I dug up getopt… But then I quickly spiralled down the time-sucking rabbit hole of trying to automate some other bits, like being able to print the “usage” by “simply” plucking out all the options given to getopt in the first place…

Continue reading →

sed Shennanigans…

Escaping…

For anyone familiar with regular expressions, the need to escape characters, that might otherwise be construed as some “special command”, is a regular affair…

sed posed a particular challenge for me when attempting to escape variables that are used as a replacement string. So, to cut the long story short, after 8 hours of trying, testing and re-testing, I finally got the solution…

In a bash shell, try the following:

TESTSTRING='\/12345678\90!@#$%^&*()-_=+{}[];:",.<>? `~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
sed "s#\([^[:alnum:]]\)#\\\\\1#g"<<<$TEST

Otherwise, in a script, try the following:

TESTSTRING='\/12345678\90!@#$%^&*()-_=+{}[];:",.<>? `~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
TESTSTRING=`echo $TESTSTRING|sed 's#\([^[:alnum:]]\)#\\\\\1#g'

WARNING: This does not work with intended backreferences (e.g. \1, \2, … \9, etc.) as the leading backslash will also be escaped (see the \9 in the tests above).

NOTE: The single-quote character was not part of the tests as I could not find a way to escape that as part of the variable assignment.