Plurrrr

a tumblelog
week 10, 2021

Fitting cubic Bézier curves

Cubic Béziers are by far the most common curve representation, used both for design and rendering. One of the fundamental problems when working with curves is curve fitting, or determining the Bézier that’s closest to some source curve. Applications include simplifying existing paths, efficiently representing the parallel curve, and rendering other spline representations such as Euler spiral or hyperbezier. A specific feature where curve fitting will be used in Runebender is deleting a smooth on-curve point. The intent is to merge two Béziers into one, which is another way of saying to find a Bézier which best approximates the curve formed from the two existing Bézier segments.

Source: Fitting cubic Bézier curves, an article by Raph Levien.

Calling the Docker CLI from Python with Python-on-whales

Today, we’re presenting a new project built by Gabriel de Marmiesse from the Docker community: Python-on-whales. The goal of this project is to have a 1-to-1 mapping between the Docker CLI and the Python library. We do this by communicating with the Docker CLI instead of calling directly the Docker Engine HTTP API.

Source: Calling the Docker CLI from Python with Python-on-whales, an article by Gabriel de Marmiesse.

Docker Security Cheat Sheet

Docker is the most popular containerization technology. Upon proper use, it can increase the level of security (in comparison to running applications directly on the host). On the other hand, some misconfigurations can lead to downgrade the level of security or even introduce new vulnerabilities.

The aim of this cheat sheet is to provide an easy to use list of common security mistakes and good practices that will help you secure your Docker containers.

Source: Docker Security - OWASP Cheat Sheet Series.

Speed of Rust vs C

The run-time speed and memory usage of programs written in Rust should about the same as of programs written in C, but overall programming style of these languages is different enough that it's hard to generalize their speed. This is a summary of where they're the same, where C is faster, and where Rust is faster.

Source: Speed of Rust vs C.

Self-supervised learning: The dark matter of intelligence

In recent years, the AI field has made tremendous progress in developing AI systems that can learn from massive amounts of carefully labeled data. This paradigm of supervised learning has a proven track record for training specialist models that perform extremely well on the task they were trained to do. Unfortunately, there’s a limit to how far the field of AI can go with supervised learning alone.

Source: Self-supervised learning: The dark matter of intelligence, an article by Yann LeCun and Ishan Misra.

Haskell Programming from First Principles print version pre-sale!

In the evening I received an email from Christopher Allen, one of the authors of Haskell Programming from First Principles, telling me that the printed hardcover edition is now available as a pre-sale.

I am currently working through the PDF version of the book and it's very well written.

See Haskell Programming from First Principles print version Pre-Sale for more information.

Iterators and Generators

Processing each item in a collection is a very common operation, no matter the programming language. JavaScript is no exception and provides a number of ways to iterate over collections. The spectrum ranges from simple for loops to the more complex map() and filter().

Iterators and Generators bring the concept of iteration, build into the core of JavaScript and provide a mechanism for customizing the behavior of for…of loops.

Source: How JavaScript works: iterators + tips on gaining advanced control over generators, an article by Alexander Zlatkov.

A gentle introduction to multithreading

Modern computers have the ability to perform multiple operations at the same time. Supported by hardware advancements and smarter operating systems, this feature makes your programs run faster, both in terms of speed of execution and responsiveness.

Writing software that takes advantage of such power is fascinating, yet tricky: it requires you to understand what happens under your computer's hood. In this first episode I'll try to scratch the surface of threads, one of the tools provided by operating systems to perform this kind of magic. Let's go!

Source: A gentle introduction to multithreading.

From Vim to Emacs in Fourteen Days

Yes, my friends, it is true. After more than fifteen years using Vim, teaching Vim, proselytizing about Vim, all the while scoffing in the general direction of Emacs, I’ve seen the light. The light of Lisp… Or something.

If, like me, you’re curious enough to give Emacs a try, this post should help you get off the ground.

It’s taken me at least the fourteen days described in the title, but with my help it should only take you two or three. There are some things to get used to, some new paradigms, and you have to learn a bit of Lisp (Elisp, actually), but don’t be afraid, it’s not that hard.

Source: From Vim to Emacs in Fourteen Days , an article by Aaron Bieber.

Emacs org-mode examples and cookbook

This document provides examples of different things that can be done in emacs org-mode files. This is not intended to be a tutorial. The examples should provide a clue of what you need to look up in the org-mode manual.

Source: Emacs org-mode examples and cookbook, an article by Eric H. Neilsen, Jr.

Customizing the FreeBSD Kernel

In this article, we will be looking at the various ways to customize the build of the FreeBSD kernel and its loadable modules. Understanding this process is invaluable for making custom additions or tuning the kernel build for a specific piece of hardware.

What we’ll cover in this article:

  1. Kernel config file format and configuration
  2. Kernel module Makefiles
  3. Building out-of-tree modules

Source: Customizing the FreeBSD Kernel

Building Webhooks Into Your Application

If your application is generating data that’s of interest to your customers (i.e. you’re doing something right), you’re going to get requests for webhooks at some point. But there’s not a ton of standard guidance for how to build them, especially on the security side. This post will walk through the basics of how to send out webhooks from your app, manage authentication, handle security, and provide a smooth developer experience to your customers.‍

Source: Building Webhooks Into Your Application: Guidelines and Best Practices.

How to Create PostgreSQL Test Data

Developing high quality software inevitably requires some testing data.

You could be:

  • Integration testing your application for correctness and regressions
  • Testing the bounds of your application in your QA process
  • Testing the performance of queries as the size of your dataset increases

Either way, the software development lifecycle requires testing data as an integral part of developer workflow. In this article, we'll be exploring 3 different methods for generating test data for a Postgres database.

Source: How to Create PostgreSQL Test Data, an article by Christos Hadjiaslanis.

Doom Emacs Configuration

Emacs is built in the same language you configure it in (Emacs Lisp, or elisp). It comes with a broad array of useful functions for text-editing, and Doom adds a few handy little convenience functions.

Source: Doom Emacs Configuration.

JavaScript: What is the meaning of this?

JavaScript's this is the butt of many jokes, and that's because, well, it's pretty complicated. However, I've seen developers do much-more-complicated and domain-specific things to avoid dealing with this this. If you're unsure about this, hopefully this will help. This is my this guide.

Source: JavaScript: What is the meaning of this?, an article by Jake Archibald.

MicroOptimizing MySQL at scale

I’ll try to break this article down in 3 distinct areas (though, they can overlap a bit) – client, server and OS. The easiest optimizations for anyone to apply are probably query optimizations (client side). But we can also improve things directly on the MySQL server and even on the OS level. (All the things I write about here are MySQL with InnoDB, but they should be applicable to many other relational databases).

Source: MicroOptimizing MySQL at scale, an article by Aleksandar Ikonic.