Home#
Blog posts#
2024-08-02 - Using Docker Compose in GitHub Workflows
GitHub Actions is a powerful tool for automating your CI/CD pipelines. It allows you to run your tests, build your code, and deploy your applications with ease. One of the most common use cases for GitHub Actions is building and testing Docker images. The example below shows how to use Docker Compose in a GitHub Workflow to build and test a Docker image when the docker-compose.test.yml file is present that contains the test configuration.
This run a seperate executable called docker-compose to build and run the tests, but the error message shows that the command is not found. The error message is shown below:
2024-07-12 - Automate pull-request approval for Dependabot
Dependabot is a service that automatically updates your project dependencies by creating pull requests. It is a great tool to keep your project up-to-date with the latest security patches and bug fixes. However, managing these pull requests can be time-consuming, especially if you have many dependencies. As a result, many teams end up ignoring Dependabot pull requests, which can lead to security vulnerabilities and other issues.
The example configuration below shows that Dependabot will automatically update the Docker base image and GitHub Actions. It ignores major version updates for Amazon Linux, Fedora, Oracle Linux, and Rocky Linux reducing the noise in the pull requests.
2023-12-02 - How to use GitHub Actions to automatically upload to GitHub Wiki
GitHub is a great platform for hosting open source projects. It provides a lot of features for free, including a wiki for documentation. However, the wiki is primarily designed to be edited through the web interface. This is not ideal for a lot of reasons as it makes it difficult to track changes from the repository. But there is a way to automatically upload to the wiki using GitHub Actions as GitHub provides a way to checkout the wiki as a separate repository.
The first step is to create a GitHub Action that will upload the wiki. This can be done by creating a new file in the
.github/workflows
directory. The following example shows how to create a GitHub Action that will upload the wiki on every push to the master branch and on every change to the.github/workflows/wiki.yml
file or thewiki
directory.2023-11-24 - Adding Google Analytics to Sphinx
Creating and maintaining a website is a lot of work and it is nice to know which pages are being visited and how people are finding your site. Google Analytics is a great tool for this and it is easy to add to your Sphinx site. But adding it to your Sphinx Sphinx blog is not as easy as it could be. This post will show you how to add Google Analytics to your Sphinx site instead of modifiying the theme or template files.
The first step is to create a Google Analytics account and get your tracking ID. This is a long string that looks like
G-XXXXXXXXX
. You can find it in the admin section of your Google Analytics account.2023-09-30 - Use magic methods __setitem__() and __getitem__() in Python
In Python, there are two magic methods that can be used to implement the behavior of the subscript operator
[]
. These methods areobject.__setitem__()
andobject.__getitem__()
. The first one is used to assign a value to an item, the second one is used to retrieve an item.The following example shows how to use these methods to implement a memory class as a list of bytes that was used in the 6502 emulator. The memory class has two methods
get()
andset()
that are used to retrieve and assign a value to a memory address.