Thu 02 Jul 2020

Or-patterns and guards may just not compose well

PEP 622 proposes adding a pattern matching construct to Python. Pattern matching allows the programmer to destructure data with a syntax that mirrors the construction syntax. The proposal brings Python in-line with many other modern programming languages, like Haskell, OCaml, and Rust. However, two features included in the proposal (or-patterns and guards) interact in a perhaps surprising way—see this paper for an explanation of this interaction as it relates to OCaml, another language with both or-patterns and guards.

Source: Python pattern matching: Guards and or-patterns might not interact in the way you expect, an article by Nick Roberts.

Port knocking with OTP to secure SSH port

An interesting concept that I’ve come across is port knocking. Note that this is just an additional layer of security. Port knocking is sending packets to a pre-defined sequence of ports, so that recipient knows it is coming from a trusted client and open the port for you. It is the same concept of making a secret doorbell ring pattern with your close friends so that you know who is ringing the door!

Source: Port knocking with OTP to secure SSH port, an article by Armin Nikdel.