Home
Julius Gamanyi
Cancel

Powershell - check local admin user is enabled

Aim: check if local admin user on Windows is enabled using PowerShell. It’s better to use the SID for the local administrator account instead of the hard-coded English name, Administrator, because...

AWS S3 - Create folder or prefix if not exists

I’d like to create a top-level directory in S3 if that directory doesn’t exist. Since S3 deals with objects, the concept of a directory is mapped to S3’s concept of prefix. The AWS S3 Cli call re...

AWS SSM - Send commands to run on remote Windows EC2 Instance

Aim Recently, I wanted to execute commands from my local machine (even a CI machine) on a remote Windows EC2 instance. In other words, send a bunch of commands that get executed on a remote EC2 in...

GitHub Actions - Packer error NoCredentialProviders

Problem: Packer shows aws.Config.CredentialsChainVerboseErrors When running Packer within GitHub Actions, I saw this error: ==> amazon-ebs.ami_name: Stopping the source instance... amazon-...

GitHub Actions - Python with Custom Package Index

Aim: build python code that pulls packages from a custom pypy (Python Package Index). And pushes own packages to that private index. Add to git repo In the git repo, add the following: Add th...

Powershell - prefer WebClient for downloads not Invoke-WebRequest

When downloading files in PowerShell, using .NET’s WebClient is way faster than using Invoke-WebRequest. Recently, downloading a 1.5GB file using Invoke-WebRequest took about 20 minutes. For the s...

GitHub Actions - pass list to bash for processing

Set list in a GitHub Actions workflow. And pass it to bash for processing. name: my workflow on: workflow_dispatch: . . . jobs: jobA: # . . . steps: - name: Print Lis...

Bash - save curl response code and body in variables

Save curl httpcode and response in variables for further processing. Found via https://unix.stackexchange.com/a/572434 #!/bin/bash URL="https://example.com" response=$(curl --silent --write-out ...

Bash and curl - pass variables to curl

I often call curl in a bash script. How do I pass variables that I’ve set in bash as arguments to curl’s command line option, say --data? Below is an example without variables. curl \ --header ...

Bash - declare and loop over array

How to declare an array and loop over it? # declare array: https://www.gnu.org/software/bash/manual/html_node/Arrays.html declare -a myArray=("Linux Mint" "Fedora" "Red Hat Linux" "Ubuntu" "Debian...