Page 2 of 11

How to manage multiple AWS accounts for the AWS CLI on the same computer Mar 6 2021

Lately, I’ve had to work with multiple AWS accounts, and some of them are ephemeral. I don’t want to have them bloating my ~/.aws/credentials file. In this short post, I’ll show you how to manage multiple AWS accounts using the tool direnv.

Before getting to using direnv, let’s cover some basic concepts, so we all start from the same base.

AWS CLI tool

In normal circumstances, we use the following command to configure our AWS CLI:

Read More...

Notes on how to upgrade a legacy Ruby application Feb 21 2021

Upgrading any legacy application is a headache. You are trying to pay a technical debt of years in a couple of weeks or months. It isn’t easy, but it is also the best time to get things right for the next time you need to do an upgrade. In this short post, you’ll find some of my notes on upgrading a legacy Ruby application.

Let’s start with a step that sometimes we ignore, but it’s the most important, taking good notes.

Read More...

A simple setup for a Build and Deploy system using GitHub Actions Dec 12 2020

I’ve been using GitHub Actions on a few projects now, and I find them like the future of what bash scripting was back in the day. I feel I can do pretty much everything in a quick and concise way. In this post, I’ll show you the setup I use for a simple Build and Deploy GitHub Action.

This post is not an in-depth view on GitHub Actions, but let’s review some basic concepts, so we know what we are talking about.

Read More...

Set up a macOS Parallels Virtual Machine for security research Nov 16 2020

macOS comes with a good set of predefined security features designed to keep us safe, e.g. System Integrity Protection. These security features are great for everyday use, but they get in the way when we are trying to analyse what processes are doing, for example, attaching to a process using lldb. In this post, I’ll show you how to set up a Virtual Machine (VM) using Parallels Desktop and Disable SIP so you can use the VM as your research lab.

Read More...

Adding dark mode to a UIKit App Nov 4 2020

First, remember create a new branch for the changes, we can do that using Xcode or the git(1) command-line tool.

The basic support

iOS 13 introduced semantic colours, so UIKit already comes with support for automatic colour selection depending on the UserInterfaceStyle. So the simplest setup is to change our UIColor to semantic colours. For example:

Read More...

Understanding SwiftNIO by building a text modifying server Aug 20 2020

Building a network application requires a good amount of effort, not only because of the complexities of the application you are building but also by the nature of network architecture. We have to define how are we going to handle the connections, the abstractions we’ll use to differentiate between network code and our application code, etcetera. Here is where SwiftNIO comes in, it provides an efficient non-blocking event-driven model, that is easy to use and extend. If we follow SwiftNIO’s model, we can take a lot of the boilerplate set up away and focus on building the logic of our applications. In this post, I’ll show you how to use SwiftNIO and understand its workflow by creating a server that receives text from clients and returns a modified version of the text.

Read More...

Building a text-based application using Swift and ncurses Aug 6 2020

The ncurses(3) library powers many popular text-based applications, for example, emacs(1) and htop(1). The use of ncurses is not required to build text-based applications. We could use escape sequences. And for small command-line tools escape sequences are enough, but sometimes it’s nice to rely on a library that handles edge cases. In this post, we’ll build a text-based clock that uses SwiftCursesTerm, a wrapper library I created for using ncurses in Swift.

Read More...

Generate table of contents with anchors for markdown file - Vim plugin Jul 20 2020

Vim is my preferred text editor, and I do most of my writing on markdown. If you haven’t used markdown, I encourage you to try it out. Markdown is a simple markup language that is in common use on the internet for static site generators. The syntax is easy to remember; that is probably why I prefer it. One useful improvement to our markdown files is the addition of a tabel of contents. Having a table of contents on my documents is handy, but more than just having the table of content being able to navigate to the sections is even better. In this short article, I’ll show you how I accomplish this by using my modified version of the vim-markdown-toc plugin.

Read More...

How to read passwords and sensitive data from the command-line using Swift Jul 17 2020

Shoulder surfing is a real threat. And we, as software developers, should strive to provide safety to our users. One way to mitigate the inadvertent exposure of sensitive data is related to how we handle the input of sensitive data in our applications. Every time the user inputs sensitive data, we should hide it from prying eyes. In this post, we’ll learn how to read passwords and passphrases on a command-line tool built using Swift.

Read More...

Understanding the Swift Argument Parser and working with STDIN Jul 7 2020

Operating systems have provided command-line interfaces for decades now, and all but the simplest command-line tools require argument parsing. Due to years of use and refinement, there are many expectations on how command-line tools should handle arguments. Because of these popular conventions, creating an argument parser is not as simple as we might think.

Creating a bespoke argument parser might not be where we would like to spend most of our time. The good news is that you don’t have to, Apple open-sourced the Swift Argument Parser (SAP). In this post, we’ll learn how the Swift Argument Parser works, and how to use it for handling STDIN for composable command-line tools.

Read More...