web components with Nim and Karax

Inspired by a tweet from a fellow developer, I decided to take a look at Karax, a nifty framework for developing single page applications in Nim. After following the basic tutorials and examples, I searched for something more complex and found very sparse documentation, so I’ll write my findings here. As usual, the complete source code is on my github repo, where you can find also a working live demo. In this example I wanted to experiment with the component pattern, and create a stateful module that can be reused. So I modeled a nim clock object, here the source: ...

July 7, 2022 · Andrea Manzini

automate OTP credentials for multi-factor authentication

Background: I work with one or more terminal command-line always opened and having to pick up my phone to generate an OTP breaks my flow; also it’s always nice to have an alternate source of multi-factor authentication if something bad happens, one day you could lose or break your trusty mobile device. Therefore I was looking for a way to login through Okta portals without a phone. You may argument that this defeats the whole meaning of MFA, but let’s say it’s only an hack for research and fun purpose … ...

June 14, 2022 · Andrea Manzini

linux resource control with cgroups

intro Resource isolation is an hot topic these days, and it’s a problem excellently solved by containerization. However, we can achieve isolation between internal tasks of an operating system by leveraging a technology exposed by the kernel: cgroups. This component is also used by Docker, and other Linux container technologies. Cgroups are the Linux way of organizing groups of processes: roughly speaking a cgroup is to a process what a process is to a thread: one can have many threads belonging to the same process, and in the same way one can join many processes inside the same cgroup. ...

May 3, 2022 · Andrea Manzini

integration between Python and Rust - Part 2

In this post we are going to write a new module for python: a very simple function exported from Rust that we can consume in the Python interpreter. We’ll leverage the PyO3 Rust bindings for the Python interpreter. Let’s start with a new Cargo project: $ cargo init --lib demo_rust_lib and insert the required settings in Cargo.toml: [package] name = "rusty" version = "0.1.0" edition = "2021" [lib] name="rusty" crate-type = ["cdylib"] [dependencies.pyo3] version = "*" [features] extension-module = ["pyo3/extension-module"] default = ["extension-module"] now it’s a matter to write our library; luckily the PyO3 library exposes a lot of useful types for python interop; the only thing we need to add is an extra fn named as our module that “exports” the functions we want to make available in the Python layer: ...

January 7, 2022 · Andrea Manzini