Home
Julius Gamanyi
Cancel

jq - Create json from scratch

How do I create a json structure from scratch using only jq? The command line option --arg name value passes a value to the jq program as a predefined variable… so --arg foo 123 will bind $foo ...

GitHub Actions - Print GitHub Webhook events and payloads

Many times, I want to know what the Json payload looks like when an event occurs on GitHub that triggers a GitHub Actions workflow. In the past, I used to setup a Webhook that sends the json paylo...

Powershell - upload file to Nexus Repo Manager

I preferred solution 3 listed on devops schools because it builds on other TILs I alread have, such as Powershell - basic auth in Authorization header The tricky part was using the InFile option. ...

jq with bash - read multiple values and save in variable

Sometimes I need to read multiple string values from json, and save them into their own variables as a pre-processing step. Assigning multiple variables in Bash using process substitution, i.e., &...

C4 model in diagrams.net - resize

Diagrams.net (previously drawio) has shapes for the C4 model of visualising software architecture. When I initially added a diagram, I couldn’t resize it. But came across a solution via [Google Gr...

Powershell - basic auth in Authorization header

Given a username and password, how do I add them as encoded values in a HTTP header when making a webservice call with Invoke-RestMethod ? $user = "User" $password = "S3cr3t" $pair = "$($user):$($...

Cloudformation - Update existing role

Context I used one Cloudformation template to create an IAM role - an InstanceRole with limited permissions. I wanted to add additional permissions (e.g., being able to write to a particular path ...

Shell Terminal - save credentials in env var

Sometimes I need to save credentials in an environment variable that I can later use in a script. # prompt for user for username. read -s -p "Enter username: " SECRET_USER # User types the usernam...

Packer - Debug log vs debug mode

When it comes to troubleshooting HashiCorp’s Packer builds, Packer offers 2 ways: More detailed logging that’s activated by setting the PACKER_LOG environment variable to a value that’s not "" nor...

GitHub Actions - setup-actions use versions preinstalled on runner

tl;dr setup-actions uses versions preinstalled on a self-hosted runner. If a version is specified in the GitHub Actions workflow yml file but it’s not preinstalled on the self-hosted runner, then ...