Skip to content

Instantly share code, notes, and snippets.

@shirshir
shirshir / README.md
Created September 12, 2021 09:56 — forked from pamolloy/README.md
Ubiquiti USG configuration for Wireguard

Download the latest ugw3 package from https://github.com/Lochnair/vyatta-wireguard/releases and install it on your USG using dpkg -i wireguard-ugw3-<version>.deb.

cd /config/auth
umask 077
mkdir wireguard
cd wireguard
wg genkey > wg_private.key
wg pubkey < wg_private.key > wg_public.key
@shirshir
shirshir / handling-optional-input-fields-with-type-safe-abstractions.md
Created October 25, 2024 07:54 — forked from Ocramius/handling-optional-input-fields-with-type-safe-abstractions.md
Handling optional input parameters in PHP with `vimeo/psalm` and `azjezz/psl`

Handling optional input parameters in PHP with vimeo/psalm and azjezz/psl

I had an interesting use-case with a customer for which I provide consulting services: they needed multiple fields to be marked as "optional".

Example: updating a user

We will take a CRUD-ish example, for the sake of simplicity.

For example, in the following scenario, does a null $description mean "remove the description",