Quick reference/Howto – Create a PR on Github

Initial setup

To create a PR you first need to setup API keys and gpg signature for your account on github.

To make git always sign your commits using your gpg signture, set the following config for git:
git config --global user.signingkey <key id>
git config --global commit.gpgsign true

You can find your gpg key id using:
gpg --list-secret-keys --keyid-format=long

Password for the account when prompted is your API key.

Create the PR

  1. Fork the repository on github.com that you want to create a PR for.
  2. Clone your forked repository: git clone <url>
  3. Change directory to the cloned repository and create a new branch: checkout -b <branch>
  4. Make your changes
  5. Add your changes: git add .
  6. Commit your changes to your forked repository: git commit -m "type your commit description here"
  7. Check origin using: git remote
  8. If your origin is “origin”, type: git push origin <branch> (branch is the branch in step 3)
  9. Go to your fork on github.com to submit the PR.

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 “192.168.1.55” and “192.168.1.56”
In OpenWrt, add this to /etc/config/dhcp:

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

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.