Plurrrr

week 23, 2023

asyncio

I'd like to put forth my current thinking about asyncio. I hope this will answer some of the questions I've received as to whether Peewee will one day support asyncio, but moreso I hope it will encourage some readers (especially in the web development crowd) to question whether asyncio is appropriate for their project, and if so, look into alternatives like gevent.

Source: asyncio, an article by Charles Leifer.

Fast X (2023)

Dom Toretto and his family are targeted by the vengeful son of drug kingpin Hernan Reyes.

In the evening Esme and I watched Fast X. The movie was OK and I give it a 6 out of 10.

An introduction to @scope in CSS

In January 2019 I raised an issue in the W3C CSS GitHub titled Please bring back scoped styles. There had once been a scoped HTML attribute but it got deprecated. It’s been replaced by @scope in CSS. Browser support is still forthcoming. It’s due to land in Chrome 117. Safari has a positive position on the specification.

There are two selling points of @scope: styling based on proximity and setting a lower boundary for a selector.

Source: An introduction to @scope in CSS, an article by Ollie Williams.

Writing Safe Shell Scripts

Writing shell scripts leaves a lot of room to make mistakes, in ways that will cause your scripts to break on certain input, or (if some input is untrusted) open up security vulnerabilities. Here are some tips on how to make your shell scripts safer.

Source: Writing Safe Shell Scripts.

Proof in Functions

Swift’s generic functions allow us to explore a beautiful idea that straddles the line between mathematics and computer science. If you write down and implement a function using only generic data types, there is a corresponding mathematical theorem that you have proven true. There are a lot of pieces to that statement, but by the end of this short article you will understand what that means, and we will have constructed a computer proof of De Morgan’s law.

Source: Proof in Functions, an article by Brandon Williams.

Evil Dead Rise (2023)

A twisted tale of two estranged sisters whose reunion is cut short by the rise of flesh-possessing demons, thrusting them into a primal battle for survival as they face the most nightmarish version of family imaginable.

In the evening Alice, Esme, and I watched Evil Dead Rise. I liked the movie and give it a 7 out of 10.

Understanding CPUs can help speed up Numba and NumPy code

When you need to speed up your NumPy processing—or just reduce your memory usage—the Numba just-in-time compiler is a great tool. It lets you write Python code that gets compiled at runtime to machine code, allowing you to get the kind of speed improvements you’d get from languages like C, Fortran, or Rust.

Or at least, that’s the theory. In practice, your initial Numba code may be no faster than the NumPy equivalent.

But you can do better, once you have a better understanding of how CPUs work. And this knowledge will help you more broadly with any compiled language.

Source: Understanding CPUs can help speed up Numba and NumPy code, an article by Itamar Turner-Trauring.

Why Liquid Haskell matters

Liquid Haskell is a tool that can analyse a program and calculate proof obligations that would ensure that the program meets some specification (not unlike Dafny, Why3, or F*). The specification is included in the program as a special comment inserted by the programmer. The compiler ignores this comment, but Liquid Haskell can find it. Once the proof obligations are identified, they are given to a theorem prover (an SMT solver specifically) in an attempt to save the programmer the trouble of writing a proof.

Source: Why Liquid Haskell matters, an article by Facundo Domínguez.

Rate limiting in HAProxy and Nginx

Rate-limiting is a common strategy for safe guarding a server from potential DDoS attacks or sudden peaks in network traffic. Rate-limiting instructs the server to block requests from certain IP addresses that are sending an unusual number of requests to the system.

We can apply rate-limiting to both Nginx and HAProxy. Nginx runs on each end node hosting the service, while HAProxy serves as the load-balancer and distributes incoming requests among available nodes. This post describes how to rate-limit requests on both Nginx and HAProxy and shows how to whitelist IPs and rate-limit a single URL. The final section shows how to apply this configuration in Puppet.

Source: Rate limiting in HAProxy and Nginx, an article by Adeel Ahmad.

Hunter Killer (2018)

An untested American submarine captain teams with U.S. Navy Seals to rescue the Russian president, who has been kidnapped by a rogue general.

In the evening Esme and I watched Hunter Killer. I liked the movie and give it a 7 out of 10.

In Praise of Perl

Programming languages rise and fall in popularity. For awhile everyone is keen on C, then C++, followed by languages such as Golang, Rust, Haskell, Python, or [fill in the blank with your favourite language]. Their popularity is frequently driven by need — the desire to find the best tools for highly complex programming projects.

Some languages fall by the wayside. Few programmers still use Algol, Fortran, COBOL, Basic, or Pascal. Though they were widely used in their day, they now appear mainly in legacy programs.

And some languages, while no longer as widely used, still persist among those who appreciate their special qualities. These include Common Lisp and, my favourite, Perl.

Source: In Praise of Perl, an article by Gene Wilburn.

PyStack

PyStack is a tool that uses forbidden magic to let you inspect the stack frames of a running Python process or a Python core dump, helping you quickly and easily learn what it's doing (or what it was doing when it crashed) without having to interpret nasty CPython internals.

Source: PyStack.

Three-way handshake bypassing Little Snitch

There has been some discussion recently about the bypassing of Little Snitch by the first datagram of a three-way TCP handshake. The facts: When a deny-rule for a domain is set in Little Snitch, and a TCP connection is made to that domain, a TCP SYN data packet is sent to the remote server. Although this packet does not carry any payload, it does include crucial information such as your IP address, as well as the sending and receiving port numbers.

Source: Three-way handshake bypassing Little Snitch.

Modern Image Processing Algorithms Overview & Implementation in C

Image processing plays a crucial role in numerous fields, ranging from computer vision and medical imaging to surveillance systems and photography. The implementation of image processing algorithms in programming languages like C has become increasingly important due to the need for efficient and optimized solutions especially on embedded devices where computing power is still limited.

Source: Modern Image Processing Algorithms Overview & Implementation in C/C++.

ORM - data model vs domain model

There’s been quite a lot of discussion lately about whether or not to use an ORM. As someone who’s been both proponent and opponent of the use of ORM’s over the years, I figured I’d write a blog post about my current opinion on the matter (which may change again a couple of times in the future ;-)).

Source: ORM - data model vs domain model, an article by Gert Goeman.

CSS Nesting

So I almost fell out of my seat yesterday when I caught wind of the announcement that CSS nesting has landed in actual browsers and if you want to play around with them then you can do that in the latest version of Safari Technology Preview. This means it’s half a step away from landing in real browsers very soon.

Source: CSS Nesting, an article by Robin Rendle.

GPT best practices

This guide shares strategies and tactics for getting better results from GPTs. The methods described here can sometimes be deployed in combination for greater effect. We encourage experimentation to find the methods that work best for you.

Source: GPT best practices.

Why You Should Still Love Telnet

Telnet, the protocol and the command line tool, were how system administrators used to log into remote servers. However, due to the fact that there is no encryption all communication, including passwords, are sent in plaintext meant that Telnet was abandoned in favour of SSH almost as soon as SSH was created.

For the purposes of logging into a remote server, you should never, and probably have never considered it. This does not mean that the telnet command is not a very useful tool when used for debugging remote connection problems.

In this guide, we will explore using telnet to answer the all too common question, “Why can’t I ###### connect‽”.

Source: Why You Should Still Love Telnet, an article by Elliot Cooper.