Python: On typing.Protocol and Duck Typing


Python like other dynamically typed programming languages uses duck typing. Duck typing is typically explained as a type system that does not necessarily care if an object/type is labelled as a duck, but just that if it can quack then it is a duck (see another example). On the other hand, Rust, C and C++ have a nominal type system, in which types are explicitly declared. Furthermore, Python’s classical type hints introduced in PEP 484 are evaluated as a nominal type system.…
Read more ⟶

Tor as a VPN


Introduction Rather than using traditional VPNs to access region-specific websites, one could use Tor as a VPN, most easily via the Tor Browser. However, it should be noted that you reduce your security benefits from using Tor, as traffic correlation attacks likely could be easier to make, simply because there is less entropy in your traffic behaviour. Tor Tor itself can refer to many things, the protocol, the piece of software or the Tor network (computers running Tor).…
Read more ⟶

How I make random decisions that do not matter


If the decision is binary then a simple coinflip will do. Otherwise, one would need to pull out a random number generator. I typically make these unimportant decisions quickly using my phone’s clock and modular arithmetic (my favourite operator). The idea is to take the minute ($m$) on your phone clock as the input to $f(m, n) = m \mod n$, where $n$ is the number of unique choices you have.…
Read more ⟶