Home
Julius Gamanyi
Cancel

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 ...

Git grafts - merge history of multiple repos

Intention I’m currently learning CSS through Josh Comeau’s excellent course, CSS for JS. Each module has workshops/exercises that we work through. Each of these is a git repository on GitHub. My w...

Powershell - web requests for file downloads

How do I download a remote file via an API that also expects an auth Token? $DownloadedFile = "C:\tmp\filename.zip"; $Url = "https://path/" $TOKEN = "supers3crettoken" $headers = @{ 'Accept'...

Powershell - check hash of downloaded file

When downloading files, such as those attached to a github release, most have hashes. After downloading the file, how do I check that the hash of a file I’m downloading is valid? An example I’ll u...

jq - Access array index in a loop

If your json contains a list of objects, jq allows you to access such elements using an array index filter jq '.[index]' someData.json. But the value index is static, say jq '.[2]' someData.json. ...

GitHub Actions - Reusable Workflows

I followed the documentation (https://docs.github.com/en/actions/using-workflows/reusing-workflows) to create workflows that can be reused by other workflows. My difficulty in following the docs w...