If you have to rename a large number of files under Windows it is very tedious to do it one-by-one via the gui. Instead of writing a batch file, Microsoft has a suite of tools called PowerToys. PowerToys installs a utility called PowerRename that will do the job.
I did this under Windows 10, but I imagine that it is the same in Windows 11 based on the documentation on the
PowerToys installation page. Installation
Start a PowerShell as
Continue reading “Using Microsoft PowerRename to Rename Batches of Files”
Following are a number of my commonly used docker commands for my own reference
Run the following in the same directory in which your
docker build -t <image-name:<version.
Or you can specify the path to the
docker build . -t <image-name:<version-f /path/to/Dockerfile
Run a container interactively
Especially useful when debugging commands that you will encapsulate in a Docker file, this will enable you to run a base image and then execute →
Continue reading “Docker Cheat Sheet”
Some of git’s nomenclature can be confusing, especially since it is context dependent. Following are some TLDR;s for dealing with resolving merge conflicts in different scenarios.
–ours vs –theirs
The meaning of
--theirs can depend on whether you are doing a rebase or a merge.
Assuming that the
feature branch is checked out
git merge develop
git rebase develop
To keep changes from
To keep changes from
during a rebase there → Continue reading “Git Merge Conflict Resolution Cheat Sheet”
Development Tips and Tricks
Test Template Rendering
Run the following. Instead of it installing the chart it will render the template and display the output
helm install --debug --dry-run <release-name> <path-to-chart-dir>
To test with an overriding value
helm install <release-name> <path-to-chart-dir> --dry-run --debug --set k=v
Get the manifest for a release:
helm get manifest <release-name[flags]
Continue reading “helm Cheat Sheet”
One of the key features in go is simplicity. As a result there are a number of utilities and data structures that are common in other high-level languages that do not come with the go stdlib.
One of them is a stack. Following is a very simple implementation of a stack that uses a slice to store the data.
The following is an implementation of a simple stack that takes any kind of pointer.
type Stack[T any] struct
Continue reading “Implementing a Stack in Go”
The GNU diff command on most Linux and UNIX systems will diff the contents of two files. With Bash, you can, using process substitution, take the output of any arbitrary command and process its input, or output, as a file descriptor. In this way, you can then use diff against the output of two commands as follows
diff <(cmd1) <(cmd2)
cmd2 will appear as a file name/file descriptor. The
< character indicates that the file descriptor should →
Continue reading “Diffing the output of two commands”
For some things, a docker container will not work. For example, I am working on a Python project to automate the deployment and configuration of VMs and bare-metal boxes. It involves installing packages and configuring the OS and to properly test it requires a full fledged VM and not just a container.
Use packer to define the box you want to build
Install packer. The description straight from
apt show packer is
“HashiCorp Packer – A tool for creating identical → Continue reading “Creating Custom Vagrant Boxes for Integration Testing”
An easy way to parameterize a Vagrant file is to use environment variables. You simply need to export a variable and then refer to it in the Vagrant file with the following syntax.
Export the variable:
Sample Vagrant file that reads the exported variable
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "debian/bullseye64"
config.vm.box_version = "11.20221219.1"
config.vm.network "forwarded_port", guest: 22, host: ENV['SSH_PORT']
Continue reading “Using Environment Variables in a Vagrant File”
If you want to dynamically define and export variable names in Bash here is the TLDR;
# Define the name of the variable
# Declare it and export it
declare -gx "$key"="some-value"
To then access that value via a dynamically generated variable name
# Create a variable that contains the variable name
# Read the value
Read the man page for
declare for more details and
read this article for a really good explanation and further examples.→ Continue reading “Declaring, Exporting, and Reading Dynamic Variables in Bash”