Skip to content

Instantly share code, notes, and snippets.

View charltonstanley's full-sized avatar

Charlton Stanley charltonstanley

View GitHub Profile
@charltonstanley
charltonstanley / AWS4-Request-Signer.ps1
Created November 2, 2023 04:47 — forked from kalihman/AWS4-Request-Signer.ps1
Powershell AWS4 Signer for STS GetCallerIdentity Action
# Define Helper Functions
function Get-Sha256Hash ($StringToHash) {
$hasher = [System.Security.Cryptography.SHA256]::Create()
$Hash = ([BitConverter]::ToString($hasher.ComputeHash([Text.Encoding]::UTF8.GetBytes($StringToHash))) -replace '-','').ToLower()
Write-Output $Hash
}
function ConvertTo-SortedDictionary($HashTable) {
$SortedDictionary = New-Object 'System.Collections.Generic.SortedDictionary[string, string]'
foreach ($Key in $HashTable.Keys) {
@charltonstanley
charltonstanley / terraform_dynamic_resource_loops.md
Last active August 18, 2023 04:01 — forked from BennyG93/terraform_dynamic_resource_loops.md
How to produce dynamic resources in terraform 12 from 2 lists

Producing dynamic resources in Terraform 12 from 2 lists

Now that Terraform 12 has been released and iterated on a few times, the highly anticipated for_each argument has officially been integrated directly inside the resource and data blocks. Allowing for the creation of dynamic blocks.

This for_each resource loop accepts any map or set to produce its dynamic set of resources.

e.g.

@charltonstanley
charltonstanley / gpg_git_signing.md
Last active July 7, 2022 00:08 — forked from alopresto/gpg_git_signing.md
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ git config --global tag.forcesignannotated "true" ([OPTIONAL] every annotated tag (git tag -a) will now be signed.)
  7. $ git config --global tag.gpgSign "true" ([OPTIONAL] every tag will be signed.)
  8. $ echo "Some content" >> example.txt