Monthly Archives: January 2024

Migrate subfolder to separate git repository

Let’s say you have a repository structure like below (eg. because previously it was SVN repository where everything was on one place).

  • .\Web
    • .\
    • .\

Now you would like to move to separate git repository.

First of all, you need to install git-filter-repo.

# Clone old repository to new directory

# Remove everything else except directory
git filter-repo --path

# Make new root directory
git filter-repo --subdirectory-filter

# Push to a new repository
git remote add origin NEW_REPOSITORY
git push -u origin master

Connect to Mac using VNC from Windows using encrypted connection

On Mac you need to enable Remote Login and Screen Sharing.

Note: If Remote Login is not starting with message “Remote Login starting…” you might need to manually add a launch daemon:
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist

On Windows run Powershell and create encrypted SSH tunnel. Replace USERNAME with your user name and MAC_IP_ADDRESS with IP address of your Mac.


Now use a VNC client (eg. RealVNC Viewer) and connect to RealVNC will still complain about unsecure connection but the connection will be local only (

UniFi Protect behind nginx proxy

Below is a snippet of nginx configuration that will enable access to your UniFi Controller (eg. Unifi Cloud Key Gen2) using nginx reverse proxy.

server {
        listen 443 ssl;

        location / {
                include /etc/nginx/proxy_params;
                proxy_pass https://IP_ADDRESS_OF_THE_CONTROLLER/;

                # WebSocket support
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";

Installing Arch Linux ARM on Raspberry PI 3

Insert SD card to your system.

sudo fdisk -l
sudo fdisk /dev/sdX

Create partitions.

  • Clear partitions (o)
  • Create boot partition (n, p, 1, enter, +500M, t, c)
  • Create system partition (n, p, 2, enter, enter)
  • Write partitions (w)
sudo mkfs.vfat /dev/sdX1
sudo mkfs.ext4 /dev/sdX2

Mount new partitions.

sudo mkdir /mnt/boot/
sudo mkdir /mnt/root/

sudo mount /dev/sdx1 /mnt/boot/
sudo mount /dev/sdx2 /mnt/root/

Download and install Arch Linux ARM.

sudo su
tar zxvf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C /mnt/root
mv /mnt/root/boot/* /mnt/boot
umount /mnt/boot/
umount /mnt/root/

Remove SD card, insert it into Raspberry PI and boot it to complete the installation.

pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu

Append value to Multi SZ Registry value using PowerShell

In the sample bellow the PowerShell script will append a service into RemoteAccessCheckExemptionList in registry. It also checks whether the value already exists there or not.

$subkey = 'SYSTEM\CurrentControlSet\Control\SecurePipeServers\SCM'
$value  = 'RemoteAccessCheckExemptionList'

$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server)
$key = $reg.OpenSubKey($subkey, $true)
$list = $key.GetValue($value)

if ($list -notcontains 'MyServiceName') {
  $list += 'MyServiceName'

$key.SetValue($value, [string[]]$list, 'MultiString')