On Learning Rust

We all have our moments when we want to learn something cool. It struck me this evening and I decided to pick up Rust again. It feels more natural this time due to my more extended knowledge of systems engineering. Now std::program::exit(1) doesn’t seem like Rust magic anymore but a standard way programs should exit gracefully. So I decided to implement Two Pointers in Rust. Boy did I forget what two pointers was. I had to ask GPT to describe two pointers in 10 words. It said something along the lines of, find two numbers in a list that sum to a target number. Now, I chose to design my program to receive all the inputs as program args. The first thing I learnt to do was collect a program’s inputs. Luckily Rust has a handy way in the standard library: std::env::args().collect(). This creates a vector of all passed arguments. Now the next thing to learn was how to parse the collected arguments. Rust prefers pattern matching to for-loops. So I picked up this piece of code from ChatGPT: ...

May 9, 2025 · 10 min

Vector Fields and the Vector Operators

hi When you place one end of a metal spoon in hot water, heat flows from the end submerged in water to the end that is not. The temperature at each point in that spoon when viewed collectively is a scalar field. If a temperature-camera were to capture this spoon, it would look like this. ...

April 27, 2025 · 2 min

Configuring Promtail: A Step-by-Step Guide

Disclaimer: this post is AI generated. Promtail is a powerful log agent designed to ship logs from local files to a Loki instance. If you’re setting up a logging pipeline with Grafana Loki, proper Promtail configuration is crucial. This guide walks you through the essential steps to configure Promtail effectively. Understanding the Configuration Process Configuring Promtail involves three key steps: Writing a proper configuration file Ensuring proper file access permissions Restarting the service to apply changes Let’s dive into each step in detail. ...

April 23, 2025 · 3 min

Serving HTML from a Docker container: Nginx vs pure Alpine

If you were asked to package HTML (and other static assets) in a Docker container, how would you achieve it? Sure, you can spin up a Node.js or Python application and create a web server that serves the required assets, but that would be a roundabout method of solving a simple problem. Of course, Nginx is a viable option, but which will you choose? $ docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE nginx latest 53a18edff809 7 weeks ago 192MB nginx stable-alpine-slim 95ebc828d689 7 weeks ago 11.8MB ...

March 29, 2025 · 5 min

Three Things about Robots

A robot needs to know how to: Localize itself Plan its paths Control itself Robots are built to do three kinds of jobs: Dirty Dangerous Dull Robots generally rely on three technologies: Sensors - for perceiving their environment Actuators - for locomotion and movement Algorithms - to guide their decision making Robots may face these three challenges: Efficiently managing energy - energy efficiency Adapting to new environments - environment adaptability Interacting with humans and other living organisms - human interaction Three general types of robots: ...

December 30, 2024 · 1 min

Faster PyTorch Model Inference Using ONNX Runtime

Training machine learning models is one thing, using them is another. When models are trained for real-time inference, you need a runtime that can deliver results with milliseconds accuracy. If you trained your model on a PyTorch pre-trained model, your inference time will not be optimal if you simply use the torch state dictionary during inference. Converting your Pytorch model into a faster runtime like ONNX is a faster alternative. In this blog post, you will learn how to convert a Pytorch state-dictionary model into ONNX format for faster inference. ...

December 28, 2024 · 3 min

How to add an IP address to an Azure VM's interface

When running virtual machines in Azure, you sometimes need to add additional IP addresses to your VM’s network interface. While Azure typically manages IP assignments through its network interface configuration, there are situations where you might need to configure IP addresses directly on the VM level. Introduction Azure VMs come with a primary IP address assigned through DHCP. This IP is managed by Azure and configured automatically when your VM boots up. However, there are scenarios where you might need to add secondary IP addresses: ...

December 20, 2024 · 3 min

Setting Up NGINX with JWT Authentication

Disclaimer, this article was AI generated Overview This guide provides detailed instructions for implementing a secure authentication system using NGINX with JSON Web Tokens (JWT). You’ll learn how to install all necessary dependencies, compile NGINX with the nginx-auth-jwt module, and deploy two complementary Go microservices: one for generating and issuing JWTs and another that demonstrates how NGINX validates these tokens in a real-world scenario. By the end of this tutorial, you’ll have a robust authentication system that can be integrated into your existing microservices architecture. ...

December 20, 2024 · 5 min

Setting Up Elasticsearch and Kibana

Okay so you want a faster and better way to go through your huge user and customer data and thought to use Elasticsearch on your Linux machine. You configured it all right and it works, but you then realize that some things are not quite right and would be happy if you could debug queries, so you thought to install Kibana. Unfortunately, you’ve forgotten the admin credentials you created for elasticsearch and not quite sure how to achieve the whole set up, so you ended up here. Worry not, for this blog post will guide you on the right way to install + configure elasticsearch and kibana on a Linux machine, specifically, Ubuntu (22.04). ...

December 6, 2024 · 1 min

Cool Linux Tools You Cant Do Without

There are several tools on Linux that just feel heavenly. Like God bless the developers that coded them. Some of these tools like top and htop handle monitoring, while others like ncdu and df tell you about your disk usage. Find below a list of these tools and how you can make use of them. ncdu ncdu falls under the disk usage category. It is an external tool so it doesn’t come with the basic linux binaries. It gives a visual output of the files present in your directories with the ability to go deeper into the tree using your arrow keys. The snippet below shows it indexing a basic node.js setup. Node.js is notorious for having large node_modules directories and this example lives up to that name. ...

November 29, 2024 · 3 min