Skip to content

Instantly share code, notes, and snippets.

View nitrocode's full-sized avatar
🚀
Thinking and typing

RB nitrocode

🚀
Thinking and typing
View GitHub Profile
@nitrocode
nitrocode / Atlantis-with-awscli-v2.md
Last active December 3, 2024 02:43
Atlantis with awscli v2

Atlantis with awscli v2

Commands

Download the Dockerfile

wget https://gist.githubusercontent.com/nitrocode/62505b0623cd9bf27e4b39a3f98412f5/raw/Dockerfile
@nitrocode
nitrocode / using-mastercard-restapi-terraform-provider.md
Last active September 8, 2022 16:56
Using the http and mastercard restapi terraform provider

Using the http and mastercard restapi terraform provider

I had an issue when trying to get the cloudflare account_id which is available using the REST API but unavailable using the cloudflare terraform provider (original thread).

✗ curl -X GET "https://api.cloudflare.com/client/v4/accounts" \
     -H "Content-Type:application/json" \
     -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" |
  jq -r '.result[] | select(.name == "<your-account-name>").id'
@nitrocode
nitrocode / k8s-api-version-for-awscli-version.md
Last active August 25, 2022 00:23
Return the correct apiVersion for the corresponding awscli version

k8s-api-version-for-awscli-version

$ get-api-version 1.23.8
v1alpha1
$ get-api-version 1.23.9
v1beta1
$ get-api-version 2.6.4
v1alpha1
$ get-api-version 2.7.0
@nitrocode
nitrocode / common-github-cli-gh-commands.md
Last active April 21, 2025 19:22
Common github cli gh commands

Common github cli gh commands

Prereqs

Install

brew install gh
@nitrocode
nitrocode / leapp-add-sessions.sh
Created June 26, 2022 14:38
Leapp cli to add sessions
#!/bin/bash
# SAML IDP ARN to use to authenticate
export LEAPP_IDP_ARN=""
# The IAM role to assume
export LEAPP_ROLE_ARN=""
# The default profile name
export LEAPP_PROFILE_NAME=""
# Both the session name and the role session name
export LEAPP_PROFILE_ALIAS=""
# The region of the saml connection
@nitrocode
nitrocode / find-aws-services-supported-in-a-region.md
Created June 14, 2022 15:29
Find aws services supported in a region

Find aws services supported in a region

REGION=ap-southeast-3

aws ssm get-parameters-by-path \
  --path /aws/service/global-infrastructure/regions/$REGION/services \
  --query 'Parameters[].Value' \
  --output text | grep -oP '[a-zA-Z0-9\-]+' | sort
@nitrocode
nitrocode / close-configure-renovatebot-prs.md
Created June 2, 2022 16:43
Close configure renovatebot prs

Close configure renovatebot prs

After enabling renovatebot on an org for the first time, it doesn't seem like there is a way to prevent opening a PR in every repo.

Using the gh cli, we can retrieve every repo, collect the PR number associated with the new PR, and close each one until we're ready to configure each.

ORG=myorg

gh repo list $ORG -L 400 --json name --jq '.[].name' &gt; repo-list.text
@nitrocode
nitrocode / github-gpg-key-with-private-email.md
Last active March 15, 2025 23:04
Github "Verified" commits using GPG key with private email

Github "Verified" commits using GPG key with private email

It's nice to see a Verified message next to each commit for peace of mind.

Using GPG or S/MIME, you can sign tags and commits locally. These tags or commits are marked as verified on GitHub so other people can be confident that the changes come from a trusted source.

  1. Install latest gpg

    If using a mac use homebrew

@nitrocode
nitrocode / bottles-to-alcoholism.md
Last active March 18, 2022 15:12
Bottles to alcholism

Some math applied to alochol

NIAAA defines heavy drinking as follows: For men, consuming more than 4 drinks on any day or more than 14 drinks per week. For women, consuming more than 3 drinks on any day or more than 7 drinks per week.

Source: https://www.niaaa.nih.gov/alcohol-health/overview-alcohol-consumption/moderate-binge-drinking

In the United States, one "standard" drink (or one alcoholic drink equivalent) contains roughly 14 grams of pure alcohol, which is found in:

  • 12 ounces of regular beer, which is usually about 5% alcohol
  • 5 ounces of wine, which is typically about 12% alcohol
  • 1.5 ounces of distilled spirits, which is about 40% alcohol
@nitrocode
nitrocode / terraform-module-from-branch.md
Last active July 31, 2022 15:46
Terraform module from git branch

Use git:: prefix before the url of the git repo and suffix it with ?ref=<branch> for a specific branch

For easy copy paste

module "example" {
  source = "git::https://github.com/cloudposse/terraform-aws-ec2-client-vpn.git?ref=master"

  # ...
}