Script in first post very discounted and therefore deleting not all files.
Here's updated version. Script automatically mounts /system, you don't need do it by yourself.
Script compatible with Android 2.3...8.1
Guaranteed delete will be only on CyanogenMod / LineageOS rom's and Nexus / Pixel firmware due of possible other file naming in manufacturer stock firmware.
Script removes apps from /system partition. Probably some of them was updated and additionally stored in internal memory.
So you need manually delete a bit of remainders as normal app.
Batch deleting available with root in Link2SD
Some bits of files can left on device (like important WebView), but almost all other will be removed.
Also here open source version of gapps (microG)
– Maybe some stuff or whole ROM will broken after applying this ZIP because modern firmwares very depends from gapps
– I've tried to remove as much possible Google-related files
– Before applying set Settings > Apps > Gear icon > Default apps > Voice & assist > both to "None" (source)
– Script removes Google Launcher, install 3rd-party app or device will not boot!
– Script removes stock Google keyboard, install 3rd party before applying!
– Script removes Google Dialer, install 3rd-party before applying!
– ...and many other apps
– Apps that display Google Maps can't be installed
– A lot of apps requests Google Play Store and Google Play Services which will be removed
– Network location will be unavailable because it's part of gapps
– Recommended to wipe dalvik-cache to rid out of unused odex-files
>>> Use it at your own risk and make full backup via recovery before flashing! <<<