avatar

Andres Jaimes

Reading gmail email on macOS using fetchmail/postfix/sendmail/alpine

This post describes the process for setting up macOS to read and store email locally –without deleting it from the remote server. The downloaded email can be read with a local application like Alpine. The process goes like this: fetchmail pulls emails from gmail fetchmail hands the emails to postfix for local delivery use alpine to read our locally delivered email use alpine to write an email, which uses postfix to relay it via gmail we can use sendmail for any other application that requires us to send emails Configuring the hostname From the Apple menu, open System Settings, and look for hostname.

Installing bash on macOS

A quick post on how to install bash on macOS to replace zsh. Why did Apple stop shipping with bash? Licenses. The older version of Bash was licensed under GPLv2, while newer versions are licensed under GPLv3. Installing bash Run the following command to install bash: 1brew install bash 2/opt/homebrew/bin/bash --version Add the newly installed shell to /etc/shells 1sudo vi /etc/shells # List of acceptable shells for chpass(1). # Ftpd will not allow users to connect who are not using # one of these shells.

Docker cheat-sheet

Posting some common docker commands: docker compose up Starts services (add –build to force rebuild) docker compose down Stops and removes everything (containers, networks) docker compose stop Stops containers but does not remove them docker compose start Restarts containers that were previously stopped docker compose down -v Also removes named/anonymous volumes docker compose down --rmi all Also removes images built by Compose

Creating C-API Interfaces for C++ code

At some point we’ll want our C++ code to interface with other languages, but since C is the standard, we have to find ways to adapt our C++ code to allow interaction via a C interface. A C API is a group of functions that allows other programs to call our C++ code using a well-known protocol. That means, we have to find ways to put our parameters and functions into a standard C wrapping so they can be used by other clients.

Compiling Java and JavaFX applications into native binaries

This article will walk you through the process of compiling Java and JavaFX applications into native binaries using GraalVM and Gluon. This version is initially focused on MacOS, but will be updated for Windows. Installing GraalVM GraalVM is a software package that includes a Java SDK and tools for converting Java programs into native applications. I recommend you to use this SDK during your development. Let’s start by downloading GraalVM. The available Java version as of the publication of this page is 22.

Creating a simple static library

This article describes how to create a simple static library using C++. A static library is a collection of object files that are linked with and copied into a target application at compile time. The resulting executable contains all the object code from the static library, so it can be executed independently of the library. Static library Let’s start by creating a simple square class: 1// src/square.h 2#ifndef SQUARE_H 3#define SQUARE_H 4 5class square { 6private: 7 double length; 8public: 9 square(double length); 10 double area(); 11}; 12 13#endif and its corresponding implementation:

C++20 Modules

In this article, we’ll see how to create and use C++20 modules. We’ll use clang-16 to compile our code. Prerequisites OSX comes with clang-14 by default (2023). We can check its version with the following command: 1clang --version 2Apple clang version 14.0.3 (clang-1403.0.22.14.1) 3Target: arm64-apple-darwin22.5.0 4Thread model: posix 5InstalledDir: /Library/Developer/CommandLineTools/usr/bin The latest version as of the time of this writing is clang-16. Use the following command to install it with homebrew:

Notes on C++

All the examples use C++17 Sort vector by property in class In this example, we defined a class called open_order that has a long long open_time field, and a constructor. To sort the vector of open_order objects based on the open_time field, we define a comparison function compare_by_open_time that compares two open_order objects based on their open_time values. The function returns true if the open_time of the first object is less than the open_time of the second object, which results in sorting the vector in ascending order of open_time.

Creating a simple dynamic library

This article describes how to create a simple shared library using C++. A shared library is a collection of object files that are linked with and loaded into a target application at runtime. The resulting executable contains only the object code that is needed to load the shared library, for this reason, the library has to be distributed with the executable. Shared library Let’s start by creating a simple sum.c program using C.

Online diff tool

This free online diff tool will help you compare two texts and highlight the differences between them. The whole process is done in your browser, so your texts are not sent to any server. Paste the text you want to compare in the boxes below and click the Compare button. ins { background: #E6FFE6; } del { background: #FFE6E6; } #diff { box-shadow: 0 0 20px rgba(0, 0, 0, 0.