Skip to content

Instantly share code, notes, and snippets.

View webknjaz's full-sized avatar
🇺🇦
#StandWithUkraine: https://github.com/vshymanskyy/StandWithUkraine

🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) webknjaz

🇺🇦
#StandWithUkraine: https://github.com/vshymanskyy/StandWithUkraine
View GitHub Profile
@webknjaz
webknjaz / README.md
Created June 27, 2023 22:00
Testing CherryPy's TLS setup

The provided below cp_tls_builtin.py and cp_tls_pyopenssl.py modules are almost bare minimum CherryPy apps set up to serve a static string over HTTPS. I say "almost" because having an HTTP handler mounted isn't really necesary to verify that TLS works but having it provides a nice visual cue when using curl, for example.

This instruction assumes that you have a freshly made virtualenv where you executed something like pip install 'CherryPy[ssl]' trustme. The ssl extra is only needed to pull in pyOpenSSL and isn't needed for the built-in stdlib TLS adapter. The trustme project is needed for demonstration purposes — it'll

@webknjaz
webknjaz / macos-13-under-parallels-18.md
Created March 7, 2023 15:53
Observations and gotchas of running macOS 13 guests under Parallels Business 18
  1. When using Parallels' port forwarding feature with the virtio network adapter under the Parallels hypervisor, the transfer rate is so slow that it takes almost 5 minutes for a 1MB file to go through. Connecting to the VM port directly, not through the forwarded port, does not exhibit the bug. Switching to a different adapter or changing the virtualization to Apple fixes it.
  2. Under macOS 13, using any network adapter other than virtio, makes networking completely non-functional. So switching the hypervisor is the only workaround available.
  3. When the number of allocated CPUs is shrinked down to 1, the Settings window may become unresponsive or parts of the settings are unavailable/grayed out. I couldn't see what apps have full disk access, for example. Increasing the CPU number to 2 makes it work. 1-CPU VMs are enough for the CI, though.

Learn Git

Please read&learn the following:

Learn to write good commit message and description

According to common commit style guides, it is required to write messages in an imperative manner. Make them actionable. Also avoid using -m as you

$ MACOS_VM_VERSION=12.4
$ MACOS_VM_CODENAME=$(softwareupdate --list-full-installers 2>&1 | grep "Version:\s$(echo "${MACOS_VM_VERSION}" | sed 's#\.#\\.#g')[0-9.]*," | awk -F' macOS ' '{print$2}' | awk -F, '{print$1}' | uniq)
$ MACOS_VM_NAME="ansible-core-ci-template-macos-${MACOS_VM_VERSION}-playground"
$ MACOS_INSTALLER_NAME="Install macOS ${MACOS_VM_CODENAME}"
$ MACOS_INSTALLER_VOLUME_NAME="${MACOS_VM_CODENAME}"-"${MACOS_VM_VERSION}"
$ MACOS_INSTALLER_VOLUME_PATH="/Volumes/${MACOS_INSTALLER_VOLUME_NAME}"
$ MACOS_DOWNLOADED_INSTALLER_APP_PATH="/Applications/${MACOS_INSTALLER_NAME}.app"
$ MACOS_CREATEINSTALLMEDIA_BIN_PATH="${MACOS_DOWNLOADED_INSTALLER_APP_PATH}/Contents/Resources/createinstallmedia"
$ MACOS_ORIGINAL_INSTALLER_VOLUME_PATH="/Volumes/${MACOS_INSTALLER_NAME}"
@webknjaz
webknjaz / azure-devops-drop-batched-lines.js
Created June 27, 2022 14:51
This is a DevTools Console snippet for hiding the `Batched CI for` lines from the output
for (const line of $x('/html/body/div[1]/div/div/div[2]/div[2]/div[2]/div/div[5]/div/div/div/div/table/tbody/a')) {
if (!line.querySelector('.fontSizeMS>.text-ellipsis').textContent.includes("Batched CI for "))
{
continue;
}
line.style.display = 'none'; // don't .remove() because it breaks the page
}
@webknjaz
webknjaz / MPRIS.md
Created May 2, 2022 23:26
Awesome WM integration with MPRIS

MPRIS is a mechanism for controlling players (including in-browser ones). It is usually bound to multimedia key presses. DEs usually have this integrated but WMs don't. To make this work in Awesome WM, playerctl can be used. It's subcommands just need to be bound to the multimedia keys.