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 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

@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.

@webknjaz
webknjaz / predictable-build-constraints.md
Last active November 28, 2021 08:17
A few thoughts on enabling reproducible builds with PEP 517

Huh?

I've got an idea to fill the void of the non-existent PEP 517 build requirements provisioning. The problem is that currently there's no first-class citizen support for reproducible builds in the PEP 517 world. People usually set lower bounds on their build backend of choice and that's about it. Even if some will set exact pins in their pyproject.toml, it's not enough because those entries may contain unpinned (transitive) dependencies. One way to do this with python -m build is to set PIP_CONSTRAINTS environment variable (I haven't actually tested this yet but I expect it to work).

That workaround is suboptimal and leaves the users with no answer on how to manage the invocations and the

@webknjaz
webknjaz / gmail.py
Created December 12, 2015 12:02 — forked from miraculixx/gmail.py
Scrapy spider for Gmail API, using Django AllAuth as the token source
# -*- coding: utf-8 -*-
import base64
from items import EmailItem, EmailLabelItem
from loader import JSONItemLoader
from oauth2spider import OAuth2Spider
class GmailSpider(OAuth2Spider):
name = "gmail"
@webknjaz
webknjaz / init_subclass.py
Created November 17, 2020 17:19
This snippet showcases how to decorate methods declared in child classes
from contextlib import contextmanager
@contextmanager
def show_start_end():
print('START')
try:
yield
finally:
print('THE END')