FreeBSD – Upgrade PHP 7.4 to 8.0 in one line

This is more of a note to myself but if you want to upgrade PHP 7.4 in one go in FreeBSD, run the following command:

pkg install `pkg query %n-%v | grep php|grep --invert json | sed 's/74/80/; s/-7.*//'`

Note: The above command excludes anything with json, the reason is because the json extension is enabled in PHP 8 by default, so there’s no such package for it. If you have other PHP json packages installed, those will be excluded too.

To check what packages the command will replace, run:

pkg query %n-%v | grep php |grep --invert json | echo `sed 's/74/80/; s/-7.*//'`

If you know what you’re doing you can edit the command for other PHP versions.

Fix Remove-AppxProvisionedPackage error

Remove-AppxProvisionedPackage : The system cannot find the path specified.
Does this look familiar? This might help fix that error for you!

It could be a mismatch somewhere that makes that command to fail.
Instead check what packages dism.exe reports is installed, we use YourPhone as example here:

DISM.exe /online /Get-ProvisionedAppxPackages

Now look at the PackageName reported by dism, then start File Explorer and go to “C:\Program Files\WindowsApps”. Here you might see a folder called Microsoft.YourPhone_2019.1126.308.0_neutral_~_8wekyb3d8bbwe which is in fact the version installed on your system, to remove it, run:

DISM.exe /online /Remove-ProvisionedAppxPackage /PackageName:Microsoft.YourPhone_2019.1126.308.0_neutral_~_8wekyb3d8bbwe

And that’s it, you have successfully removed YourPhone from your computer.

NOTE: If you do not find the app you’re looking for under “C:\Program Files\WindowsApps”, then it isn’t installed and you have a stale entry somewhere. I do not know how to remove the stale entry that dism reports though, I’ll update if I manage find to out.

Gentoo – resume compile

If a package/ebuild fails to compile on gentoo you can use this feature to continue where it failed. Useful if a compile fails and you need to make manual edits to the files. Or if a compile fails because of out of memory, can happen when you compile chromium. Run the following command:

FEATURES=keepwork emerge -av <package>

If you don’t use the “keepwork” feature, gentoo will unpack the source code again, configure and restart the compile, which might not be ideal in all cases.

Dnsmasq – Conditional DNS Forwarding for Windows Active Directory Domains

Let’s say your Windows domain is “domain.local” and your Windows DNS IP address is “” and “”
In OpenWrt, add this to /etc/config/dhcp:

        option rebind_protection '0'
        list server '/domain.local/'
list server '/domain.local/'

The trick here which isn’t well documented is that rebind protection MUST be set to ‘0’ otherwise lookups for *.domain.local will fail.
UPDATE: Be sure to NOT have filterwin2k set in dnsmasq (/etc/config/dhcp), if you do, gpupdate and AD-domain lookups will fail.

Now your other computers/devices/servers that use the dnsmasq DNS-server can resolve computers that are AD-connected.