Skip to content

Instantly share code, notes, and snippets.

@john-auld
john-auld / colima-ca-cert.md
Created August 16, 2024 13:44
Colima - Add CA certificate

How to add a CA cert to Colima

sudo cp PEM-FORMAT.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates

Restart docker kill -kill PID.

colima ssh -psandbox -- sudo sh -c "openssl s_client -showcerts -connect pkg-containers.githubusercontent.com:443 </dev/null 2>/dev/null|openssl x509 -outform PEM > /usr/local/share/ca-certificates/gh.crt && update-ca-certificates && cat /var/run/docker.pid | xargs kill"
@john-auld
john-auld / aws-lambda-sha256-hash.md
Created July 10, 2023 21:10
Calculate AWS SHA 256 Hash for Lambda

A hash value is provided for files used to load code on Lambda, see Code > Code Properties > SHA256 hash.

The hash value of a file can be found as shown below.

openssl dgst -sha256 -binary /file/path | base64
@john-auld
john-auld / tf-flatten.md
Last active July 5, 2022 09:34
Terraform flatten to manipulate structured configuration

Flatten a list of lists of objects

for_each in Terraform does not support nested for_each's, but nested configurations can be flattened using nested for loops in a locals section.

This example is needed with a resource that binds users to groups, with a one to one mapping between the group and the member.

resource "databricks_group_member" "ab" {
  group_id  = databricks_group.a.id
  member_id = databricks_group.b.id
@john-auld
john-auld / 1_kubernetes_on_macOS.md
Created April 17, 2021 14:53 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

var AWS = require('/app/node_modules/aws-sdk');
var sts = new AWS.STS();
sts.getCallerIdentity({}, function(err, data) {
if (err) {
console.log("Error", err);
} else {
console.log(JSON.stringify(data));
}
});
https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonelasticmapreduce.html
elasticmapreduce:AddInstanceFleet
elasticmapreduce:AddInstanceGroups
elasticmapreduce:AddJobFlowSteps
elasticmapreduce:AddTags
elasticmapreduce:CancelSteps
elasticmapreduce:CreateEditor
elasticmapreduce:CreateSecurityConfiguration
elasticmapreduce:DeleteEditor
@john-auld
john-auld / aws-s3-limited-perms.txt
Created July 6, 2020 08:20
AWS IAM Policy elements for S3 read, write, list and delete objects only
arn:aws:s3:::$bucket-name
s3:ListBucket
s3:ListBucketVersions
s3:GetBucketTagging
arn:aws:s3:::$bucket-name/$key-name
s3:ListMultipartUploadParts
s3:GetObject
s3:GetObjectVersion
s3:GetObjectTagging
@john-auld
john-auld / terraform_var_validate.md
Created October 10, 2019 22:41
Terraform variable validation example

Validate allowed values of a terraform variable

variable "workspace_name_allowed_values" {
  description = "Permitted values of terraform workspace"
  type        = "list"
  default     = ["dev", "sit", "prod"]
}

resource "null_resource" "is_workspace_name_allowed" {
@john-auld
john-auld / jenkins_centos7.md
Last active September 9, 2019 11:45
Install Jenkins on CentOS 7

Install notes for Jenkins on CentOS 7

sudo yum install java-1.8.0-openjdk-devel
curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key

sudo yum install jenkins
sudo systemctl enable jenkins
sudo systemctl start jenkins