Fixing High Disk Usage and Unexpected MariaDB Kills with innodb_buffer_pool_size

My client has a few Wordpress websites and they ran into a strange issue. The stack is quite simple, just Wordpress and MariaDB both running in Docker, on Google Cloud.

When it happens, the server doesn’t respond, timing out. The VM is inaccessible, cannot SSH to the VM. We checked the log of both Wordpress and MariaDB, but couldn’t find anything useful to identify the issue. There was only normal logs, and then timing out.

Read more →

Getting Logitech F310 to work with Macbook USB-C port

Connect & use Logitech F310 with Macbook

Since my Macbook Pro only has USB-C port, I used an USB-A to USB-C adapter to connect my F310 to it, but it does not work (pressing MODE button does not turn on the LED).

How to

To make it work:

  • Disconnect F310 from Mac

  • On F310: switch X-input to D-input

  • Hold Logitech button (in the middle)

Read more →

Bypassing JavaScript Focus Detection in the Browser

How to Stop Videos from Pausing When You Switch Tabs

Some sites pause videos if you switch tabs or lose focus. Here’s a quick script to bypass that behavior.

Paste This in the Console

Object.defineProperty(document, 'hidden', { value: false, configurable: true });
Object.defineProperty(document, 'visibilityState', { value: 'visible', configurable: true });
document.hasFocus = () => true;

window.onblur = null;
window.onfocus = null;
document.onvisibilitychange = null;

const blockEvents = ['visibilitychange', 'blur', 'focus'];
const origAddEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener, options) {
    if (!blockEvents.includes(type)) {
        return origAddEventListener.call(this, type, listener, options);
    }
};

This works for Vanta security awareness training. If my employer sees this, I pinky swear that I watched the whole thing and only tested the script for fun!

Read more →