a tumblelog

Now Perl 6 Is Raku, Perl 5 Can Be 7

After Perl 6's renaming to Raku, acknowledging that it really is another language, Perl can now use number 7 without fear. It already has claimed the newly freed territory with the announcement that Perl 5.32 with more modern and sensible defaults is to be Perl 7.

Source: Now Perl 6 Is Raku, Perl 5 Can Be 7, an article by Nikos Vaggalis.

All the Loops

Modern JavaScript supports many different looping constructs. I often use these different constructs for working with arrays. This is a reference, for myself and for others, written to augment the existing MDN documentation.

Source: All the Loops, an article by Matt Hall.

D-Bus and Polkit, No More Mysticism and Confusion

Dbus and Polkit are two technologies that emanate an aura of confusion. While their names are omnipresent in discussions, and the internet has its share of criticism and rants about them, not many have an actual grasp of what they actually do. In this article I’ll give an overview of these technologies.

Source: D-Bus and Polkit, No More Mysticism and Confusion, an article by Patrick Louis.

Object-Oriented Programming (OOP) in Python 3

Object-oriented programming (OOP) is a method of structuring a program by bundling related properties and behaviors into individual objects. In this tutorial, you’ll learn the basics of object-oriented programming in Python..

Source: Object-Oriented Programming (OOP) in Python 3, an article by David Amos.

A tiny Plurrrr update

In the evening I modified the Makefile I use to generate this blog. I added the --date-format argument once to and once to Default the date-format is set to '%d %b %Y'—day of the month, abbreviated month name, and year—but using the aforementioned argument I changed this to '%a %d %b %Y'. This value adds the abbreviated weekday name to the front of the date, see strftime(3).

The static microblog generator I wrote is available at GitHub. Feedback is welcome.

The Crimson Campaign: Good

In the afternoon I finished The Crimson Campaign, book 2 in the Powder Mage trilogy by Brian McClellan. While I liked the previous book in the trilogy, Promise of Blood, more I consider this still a good book; not bad for the middle book in a trilogy.

If you like the Powder Mage trilogy, you might like:

The Autumn Republic

Field Marshal Tamas has finally returned to Adopest, only to find the capital in the hands of a foreign power. With his son Taniel presumed dead, Tamas must gather his beleaguered forces and formulate a plan to defeat the Kez - no easy task when you're outnumbered and can't tell friend from foe.

The army is divided . . .

With their enemy bearing down on them, the Adran command is in disarray. Someone, it seems, is selling secrets to the Kez. Inspector Adamat is determined to flush out the traitor, but as the conspiracy unravels, he will learn a horrifying truth.

And all hope rests with one man . . .

Taniel Two-Shot, the powder mage who shot a god in the eye, is on the run. He possesses the sole means of defeating the Kez, but to do so he must evade treachery at every turn. If he fails, Adro will fall.

In the afternoon I started in The Autumn Republic, the final book in the Powder Mage Trilogy by Brian McClellan.

Recently molted Aphonopelma seemanni eating

In the afternoon I gave 2 pre-killed mealworms, Tenebrio molitor, to the female Aphonopelma seemanni I keep. The large tarantula started to molt the 27th of June, 2020 and still has a very colorfull fresh look so I decided to take a few photos of her.

Aphonopelma seemanni eating a mealworm
Aphonopelma seemanni eating a mealworm.

I pre-kill mealworms by crushing their heads to prevent them from burrowing into the substrate. The tarantula doesn't seem to mind that she doesn't have to hunt for her food; it's just delivered at the doorstep of her burrow.

Beginner’s Guide To Abstraction

Abstraction is hard to define but the process typically goes like this:

  1. you identify different chunks of code that you think are all basically doing the same thing
  2. you create a method or a class with a narrow interface which can be substituted in for all the chunks of code you found
  3. you go and swap out the chunks of code with a call to your method/class

Source: Beginner’s Guide To Abstraction, an article by Jesse Duffield.

Remap Enter to Control in GNU/Linux

Recently I’ve switched back from macOS to GNU/Linux, as my primary development environment, and I found out that my old article on remapping Enter to Control was no longer the optimal way to achieve this. It took me a bit of digging, but eventually I found dual-function-keys (a plugin for the interception framework), which does exactly what I needed and it does it splendidly.

Source: Remap Enter to Control in GNU/Linux (2020 Edition), an article by Bozhidar Batsov.

SSH Emergency Access

In this post we'll design a break glass procedure for reaching SSH hosts in an emergency, using security keys that you can store offline. This is just one approach, but you can adapt it to your circumstances. We will store an offline SSH Certificate Authority on a hardware security key, and have our hosts trust that CA. This will work on pretty much any OpenSSH setup, including our single sign-on SSH.

Source: SSH Emergency Access, an article by Carl Tashian.

A Complete Guide to Dark Mode on the Web

Let’s get into dark mode in the context of websites. We’ll delve into different options and approaches to implementing a dark mode design and the technical considerations they entail. We’ll also touch upon some design tips along the way.

Source: A Complete Guide to Dark Mode on the Web, an article by Mohamed Adhuham.

Piping made easy in Raku

A pipe is actually a very simple construct. We start two programs and connect STDOUT of the first with STDIN of the second. From the stand point of the programs they are writing to filehandles that where opened without a filename. Raku allows us to do so by using Proc::Async.

Source: Piping made easy, an article by Wenzel P.P. Peppmeyer.

The Internet has a Cat

The Purrli® user interface
The Purrli® user interface.

The sound of a purring cat is one of the most comforting sounds available and can help soothe and calm you down when you're feeling stressed. Naturally, it's not just the sound that is important, but it's also the presence of the warm cuddly cat. Purrli tries to recreate both the sound and the presence of your very own virtual cat through a custom sound engine modelled after real purrs.

With a purr that delicately changes over time, Purrli aims at making the experience as real and lively as possible. Just like a real cat, Purrli will call for your attention. Just be careful when adjusting the last slider, if you don't want to be nagged in the middle of your work.

Source: The Internet has a Cat! Meet Purrli, the Online Cat Purr Generator. by Dr. Ir. Stéphane Pigeon.

How to call a function on URL change in javascript

The history API maintains complete the navigation state. Whenever a new page is navigated history.pushState is called and page is added to the state. That means this event is called whenever the URL changes.

Source: How to call a function on URL change in javascript, an article by Trishul Goel.

Correlation vs Covariance

Correlation and Covariance are two commonly used statistical concepts majorly used to measure the linear relation between two variables in data. When used to compare samples from different populations, covariance is used to identify how two variables vary together whereas correlation is used to determine how change in one variable is affecting the change in another variable. Even though there are certain similarities between these two mathematical terms, these two are different from each other.

Source: Correlation vs Covariance.

Uncommon CSS Properties

There are a lot of CSS properties that some don’t know about, or they know about them, but forget to use them when they’re needed. Some of those can save you using JavaScript to achieve a specific result, or some can save your time by writing less CSS. As a front-end developer, I came across such things every now and then, and I asked myself, why not list all those less-used and interesting CSS properties in an article?

Source: Uncommon CSS Properties, an article by Ahmad Shadeed.

Go is Boring...And That’s Fantastic!

Every startup in Silicon Valley is using Go to build their infrastructure. Docker, Kubernetes, etcd, Terraform, Vault, Consul, Traefik and lots of other cutting-edge projects are written in Go. So what's going on? Why is everyone interested in this boring language?

Source: Go is Boring...And That’s Fantastic!, an article by Jon Bodner.

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.

Git Tags: Everything You Need to know

A git tag is a marker for a specific point in time for your repository. Well, although I say a "specific point in time", they are really just a reference to a commit. These tags are stored as files inside of the refs folder within the .git folder that is a part of every git repository.

Source: Git Tags: Everything You Need to know, an article by Alan Solitar.

Introduction to CSS Transitions

Animations have become an essential part of web design, and developers now use these to beautify content on websites. Before the release of CSS3, front-end developers had to perform animations with JavaScript, which wasn't an all pleasing process. Still, with the introduction of CSS animations, developers can now perform animations with ease.

In this article, I'm going to introduce you to CSS Transitions, walk you through the process of creating simple CSS animations, explain the Transition shorthand properties, and it's value.

Source: Introduction to CSS Transitions, an article by Nelson Michael.

New in Chrome: CSS Overview

Here’s a fancy new experimental feature in Chrome! Now, we can get an overview of the CSS used on a site, from how many colors there are to the number of unused declarations… even down to the total number of defined media queries.

Source: New in Chrome: CSS Overview, an article by Robin Rendle.

Git Switch and Restore: an Improved User Experience

If you’re like me and you’ve worked with Git for some time, you might have a couple of commands committed to your memory—from git commit for recording your changes, to git log for sensing “where” you are.

I have found git checkout to be a command that I reach for pretty frequently, as it performs more than one operation. But a single command doing more than one thing might produce a suboptimal user experience for someone learning Git.

Source: Git Switch and Restore: an Improved User Experience, an article by Ray Chuan Tay.

macOS Color Picker

After trying many apps, my favorite macOS color picker remains the built in utility.

Source: macOS Color Picker, an article by Paco Coursey.

Promise of Blood: very good

In the early evening I finished Promise of Blood, book 1 in the Powder Mage trilogy by Brian McClellan. I liked this book a lot; it's very good. In some ways it reminded me of the Mistborn Book Series by Brandon Sanderson, especially the later books. If you have read this series you might like Promise of Blood a lot, and vice versa.

The Crimson Campaign

Tamas' invasion of Kez ends in disaster when a Kez counteroffensive leaves him cut off behind enemy lines with only a fraction of his army, no supplies, and no hope of reinforcements. Drastically outnumbered and pursued by the enemy's best, he must lead his men on a reckless march through northern Kez to safety, and back over the mountains so that he can defend his country from an angry god, Kresimir.

In the evening I started in The Crimson Campaign, book 2 in the Powder Mage trilogy by Brian McClellan.

Using Bash traps in your scripts

It's easy to detect when a shell script starts, but it's not always easy to know when it stops. A script might end normally, just as its author intends it to end, but it could also fail due to an unexpected fatal error. Sometimes it's beneficial to preserve the remnants of whatever was in progress when a script failed, and other times it's inconvenient. Either way, detecting the end of a script and reacting to it in some pre-calculated manner is why the Bash trap directive exists.

Source: Using Bash traps in your scripts, an article by Seth Kenlon.

How to add support for dark mode on a website

In recent years, dark mode has grown in popularity as more and more devices and browsers are adding support for it.

Those reasons make it a great little feature that we can add on our websites to improve the experience of the users who prefer to use dark mode.

Let’s see how we can support this feature in 3 steps!

Source: How to add support for dark mode on a website, an article by Ioannis Diamantidis.

Python's reduce(): From Functional to Pythonic Style

Python’s reduce() is a function that implements a mathematical technique called folding or reduction. reduce() is useful when you need to apply a function to an iterable and reduce it to a single cumulative value. Python’s reduce() is popular among developers with a functional programming background, but Python has more to offer.

In this tutorial, you’ll cover how reduce() works and how to use it effectively. You’ll also cover some alternative Python tools that can be more Pythonic, readable, and efficient than reduce().

Source: Python's reduce(): From Functional to Pythonic Style, an article by Leodanis Pozo Ramos.

Machine Learning From Scratch

A quick start “from scratch” on 3 basic machine learning models — Linear regression, Logistic regression, K-means clustering, and Gradient Descent, the optimisation algorithm acting as a driving force behind them.

The purpose of this article is for coders to understand the inner workings of basic machine learning algorithms. To make the best use of the article, it is recommended to follow the code on your own development environment to understand the process.

Source: Machine Learning From Scratch: Classification, Regression, Clustering and Gradient Descent, an article by Jet New.

Aphonopelma seemanni: it's a girl

In the afternoon I carefully removed the exuviae of the Aphonopelma seemanni I keep from its burrow. It had started molting yesterday in the evening.

The spermathecae of an Aphonopelma seemanni
The spermathecae of an Aphonopelma seemanni.

I carefully moistened the molt with some water and manipulated it to open it up enough to see the spermathecae (female) or not (male). As this is a large molt I was able to see the spermathecae with the naked eye; it's a girl!

As the spermathecae look dark I guess they are weakly sclerotized.

I bought this tarantula 7th of March 2020 and this was the first time it molted in my care.

Eight tips to relieve those Postgres headaches

Welcome to this practical, non-exhaustive guide to some of the common issues you’ll encounter while using Postgres. We’ll go beyond the basic advice of adding indices to your queries using sequential scans. There are also a few extra tips for those using the AWS RDS service. Enjoy!

Source: Eight tips to relieve those Postgres headaches, an article by Vojtech Vondra.

Correlation VS Causation

The concepts of correlation and causation are sometimes confusing to amateur researchers. In practice, I often saw researchers considering a correlation as causation and making mistakes in conclusions. Mathematically, correlation is the necessary but insufficient condition for causation. In other words, if two things have causation relationship, these two things must have correlation relationship as well. However, if two things have correlation relationship, these two things do not necessarily have causation relationship.

In this blog post, I would use an example to talk about the concepts of correlation and causation, how to verify causation using experiments, and the caveats in using experiments to verify causation.

Source: Correlation VS Causation, an article by Lei Mao.

Aphonopelma seemanni molting

In the evening, when checking upon the Aphonopelma seemanni I keep I noticed that it was upside down in its burrow. This means the tarantula is going through ecdysis; the shedding of its old exoskeleton.

Aphonopelma seemanni molting
Aphonopelma seemanni molting.

The tarantula has been restless for about a week or so, getting out of its burrow entirely, and moving around a bit. Maybe it was looking for a better spot to moult? Or maybe because the room temperature exceeded 30°C (86°F) now and then?

In the above photo you can see the silk the tarantula has spun to close off the entry to its burrow.

If all goes well I expect to be able to collect an exuviae, the cast off exoskeleton, tomorrow, which can be used to determine the sex of the tarantula which I don't know at this time of writing. I hope female as females live much longer compared to males.

How does SQLite work? Part 1: pages!

I wanted to hack on SQLite, because I’ve used it before, it requires no configuration or separate server process, I’d been told that its source code is well-written and approachable, and all the data is stored in one file. Perfect!

Source: How does SQLite work? Part 1: pages!, an article by Julia Evans.

How to learn JavaScript

Since I’ve mentioned that I recently learned JavaScript, people have asked me how and what I recommend. So here’s my experience and best advice for 2020.

Source: How to learn JavaScript, an article by Derek Sivers.

Building a high performance JSON parser

JSON is important, damn near everything that we do as programmers or operators involves JSON at some point. JSON decoding is expensive, if your product talks JSON then performance of marshalling data in and out of JSON is important. This is a talk about designing an efficient replacement for encoding/json.Decoder.

Source: Building a high performance JSON parser, an article by Dave Cheney.

Chromatopelma cyaneopubescens eating

In the afternoon I gave the Chromatopelma cyaneopubescens, common name "Green Bottle Blue" (GBB for short), that I keep a mealworm.

Chromatopelma cyaneopubescens eating
Chromatopelma cyaneopubescens eating.

This tarantula molted a week ago.

Logistic Regression from scratch

Sometimes it's necessary to split existing data into several classes in order to predict new, unseen data. This problem is called classification and one of the algorithms which can be used to learn those classes from data is called Logistic Regression.

Source: Logistic Regression from scratch, an article by Philipp Muens.

PyTorch - how it is designed and why

Pytorch is a pretty intuitive tensor library which can be used for creating neural networks. There are many features in the framework, and core ideas that should be understood before one can use the library effectively.

The original tutorial by pytorch provides a very good introduction that guides the users along different concepts, explaining the different abstraction used in the framework. It was a pretty involved read, and assumes some knowledge on neural networks before everything on the page makes sense. So here, we will be filling in some of these gaps.

Source: PyTorch - how it is designed and why, an article by Ong Shu Peng.

Deciphering Python's Metaclasses

In Python, metaclass is one of the few tools that enables you to inject metaprogramming capabilities into your code. The term metaprogramming refers to the potential for a program to manipulate itself in a self referential manner. However, messing with metaclasses is often considered an arcane art that’s beyond the grasp of the proletariats.

Source: Deciphering Python’s Metaclasses, an article by Redowan Delowar.

Brachypelma smithi: it's a girl

Before I went to the bed I checked on the Brachypelma smithi I keep and found it already out of its molt but still upside down. The molting process had started yesterday in the evening.

Brachypelma smithi after molting
Brachypelma smithi after molting (00:33 AM).

About 10 hours later I took another photo of this specimen. It was now right side up and moved when I opened the plastic container I keep it in.

Brachypelma smithi after molting
Brachypelma smithi after molting (10:26 AM).

In the afternoon I decided to determine the sex of this specimen. I made the molt slightly wet and let it rest for a while; a moist exuviae is much easier to manipulate. In order to take a good photo of the spermathecae, if present, I put the exuviae on a piece of paper and shone a light underneath the paper.

Spermathecae of Brachypelma smithi
Spermathecae of Brachypelma smithi.

I used the macro lens I bought the 17th of June 2020, but with the LED ring light off, to take the above photo which is a 1:1 crop with some post processing in Pixelmator Version 3.9 Classic. The above photo clearly shows the spermathecae, which means that this specimen is female.

Announcing Perl 7

Perl 7.0 is going to be v5.32 but with different, saner, more modern defaults. You won’t have to enable most of the things you are already doing because they are enabled for you. The major version jump sets the boundary between how we have been doing things and what we can do in the future.

Source: Announcing Perl 7, an article by brian d foy.

Emacs Server – Why and why not?

Unknown to many of us, under the hood emacs was designed as a client/server architecture; which means, Emacs core runs as a daemon and you attach clients to it. Normally, we run both when we type emacs, but the execution of both the client and the server is transparent to the user. Before you attempt to do something fancy, this architecture is somewhat limited to localhost (1), which means that you can’t quite “remote into” an emacs running on a different host. In a world where we have tmux, mosh, and other multiplexers and mobile connectivity technologies, there may not seem like there’s much room for running emacs as a server, but we will see some advantages to this approach.

Source: Emacs Server – Why and why not?

Tolkien’s mythic plan for England

Tolkien saw a gap in England’s pre-history. There is English folklore. However, this tends to be local and on a rather small scale. There are Hengist and Horsa, the legendary first Anglo-Saxons to lead an expedition to our shores, but nothing with the grandeur and drama of the sagas mentioned above. Tolkien planned to fill in the gaps before Hengist and Horsa with a highly-developed imaginary world that harked back to a time of elves and fairies.

Source: Tolkien's mythic plan for England, an article by Niall Gooch.

The problem with Git flow

Sometimes, you can have too much of a good thing. That’s certainly true with Git flow, a well-known software development workflow that offers several options but can bog down users.

We developed GitLab Flow as the solution to eliminate messy complexity and streamline the development process. GitLab Flow brings issue tracking to the Git workflow, simplifying the process and removing confusion. The problem with Git flow

Source: The problem with Git flow, an article by Suri Patel.

PEP 622 -- Structural Pattern Matching

This PEP proposes adding pattern matching statements to Python in order to create more expressive ways of handling structured heterogeneous data. The authors take a holistic approach, providing both static and runtime specifications.

Source: PEP 622 -- Structural Pattern Matching.

Brachypelma smithi molting

In the evening, around 9:30 PM, I noticed that the Brachypelma smithi I keep since the 7th of March 2020 had turned itself upside down. This means that it's going in ecdysis; the shedding of its old exoskeleton.

Brachypelma smithi molting
Brachypelma smithi molting.

The previous time this specimen molted was the 16th of March 2020.

It's important to not disturb the spider during this process, which is often mistaken for dying by people new to keeping tarantulas. Moverover, after the process one has to wait at least 7 days before feeding the spider; its exoskeleton including the fangs have to harden out.

The End of OS X

What is striking about macOS 11.0 is the degree to which is feels more like a son of iOS than the sibling that Mac OS X was:

  • macOS 11.0 runs on ARM, just like iOS; in fact the Developer Transition Kit that Apple is making available to developers has the same A12Z chip as the iPad Pro.
  • macOS 11.0 has a user interface overhaul that not only appears to be heavily inspired by iOS, but also seems geared for touch.
  • macOS 11.0 attempts to acquire developers not primarily by being open and good, but by being easy and good enough.

Source: The End of OS X, an article by Ben Thompson.

Why I stay away from Python type annotations

Ever since optional static typing was added to Python 3.5+, the question of using type annotations keeps creeping back everywhere I work. Some see them as a step forward for the Future of Python™, but to me and many others it's a step back for what coding with Python fundamentally is. I've been in a number of debates over type annotations at work and so decided to compile some of the recurring points of discussion here.

Source: Why I stay away from Python type annotations, an article by Guillaume Pasquet.

Promise of Blood

It's a bloody business, overthrowing a king. Now, amid the chaos, a whispered rumour is spreading. A rumour about a broken promise, omens of death and the gods returning to walk the earth.

No one really believes these whispers.

Perhaps they should.

In the evening I started in Promise of Blood, book 1 in the Powder Mage trilogy by Brian McClellan.