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 →

Counter Strike 2 Practice commands

CS 2 Practice Commands

Here’s the practice commands, copy and paste to your console.

Server, teambalance, roundtime and remove bots

sv_cheats 1;bot_kick;mp_limitteams 0;mp_autoteambalance 0;mp_roundtime 60;mp_roundtime_defuse 60;mp_freezetime 0;mp_warmup_end;ammo_grenade_limit_total 5;sv_infinite_ammo 1;mp_maxmoney 60000;mp_startmoney 60000;mp_buytime 9999;mp_buy_anywhere 1;mp_restartgame 1

Practice commands and give grenades

sv_showimpacts 1;sv_showimpacts_time 10;give weapon_incgrenade;give weapon_flashbang;give weapon_smokegrenade;give weapon_molotov;give weapon_decoy;give weapon_hegrenade;sv_grenade_trajectory_prac_pipreview 1; sv_grenade_trajectory_prac_trailtime 6;

Bind button to re-throw grenades

bind p sv_rethrow_last_grenade

Then you can use p to re-throw grenades.

Read more →