Skip to content

Instantly share code, notes, and snippets.

View kedwards's full-sized avatar
🏠
Working from home

Kevin Edwards kedwards

🏠
Working from home
View GitHub Profile
@kedwards
kedwards / .env
Created February 19, 2025 04:09
Docker Compose PostgreSQL
POSTGRES_PASSWORD=pw
[email protected]
PGADMIN_DEFAULT_PASSWORD=pw
@kedwards
kedwards / cloudfront.sh
Created July 31, 2024 13:14 — forked from ahmed-abdelazim/cloudfront.sh
Bash script to update coudfront origin using aws cli
#!/bin/bash
CLOUDFRONT_DISTRIBUTION_ID=E2C3RNL2F4MRMQ
NEW_ORIGIN="origin2-zaid.s3.us-west-2.amazonaws.com"
ETAG=`aws cloudfront get-distribution --id $CLOUDFRONT_DISTRIBUTION_ID | jq -r .ETag`
aws cloudfront get-distribution --id $CLOUDFRONT_DISTRIBUTION_ID | \
jq --arg NEW_ORIGIN "$NEW_ORIGIN" '.Distribution.DistributionConfig.Origins.Items[0].Id=$NEW_ORIGIN' | \
jq --arg NEW_ORIGIN "$NEW_ORIGIN" '.Distribution.DistributionConfig.Origins.Items[0].DomainName=$NEW_ORIGIN' | \
jq --arg NEW_ORIGIN "$NEW_ORIGIN" '.Distribution.DistributionConfig.DefaultCacheBehavior.TargetOriginId=$NEW_ORIGIN' | \
jq .Distribution.DistributionConfig > config.json
aws cloudfront update-distribution --id $CLOUDFRONT_DISTRIBUTION_ID --distribution-config "file://config.json" --if-match $ETAG > /dev/null
@kedwards
kedwards / pem2pkcs12.md
Last active October 17, 2023 13:10
SSL – Convert PEM and private key to PKCS#12

PEM to PKCS12

SSL – Convert PEM and private key to PKCS#12

Convert cert.pem and private key key.pem into a single cert.p12 file, key in the key-store-password manually for the .p12 file.

openssl pkcs12 -export -out cert.p12 -in cert.pem -inkey key.pem

No password

@kedwards
kedwards / README.md
Last active April 1, 2023 02:25
Fix (apt-key deprecated)

Fix Apt-Key Issue

The Error message

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).

apt-key manpage
@kedwards
kedwards / k8-setup-master.sh
Last active December 27, 2022 19:18
k8s Setup
#!/usr/bin/bash
# Disable swap
swapoff -a
sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
# Configure persistent loading of modules
tee /etc/modules-load.d/containerd.conf <<EOF
overlay
br_netfilter
@kedwards
kedwards / k8s-dashboard.yml
Last active December 27, 2022 19:11
k8s-dashboard
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@kedwards
kedwards / delete_gh_workflow.sh
Last active August 14, 2022 16:44
Delete GitHub workflows
#!/usr/bin/env bash
set -e
opts=':hor:'
script_name=${0##*/}
script_dir="$( cd "$( dirname "$0" )" && pwd )"
script_path=$script_dir/$script_name
script_date=$(date +%Y%m%d)
@kedwards
kedwards / ansible_ssm.patch
Last active August 14, 2022 16:54
Ansible SSM
--- ansible_collections/community/aws/plugins/connection/aws_ssm.py 2022-08-06 10:06:45.655785352 -0600
+++ docs/aws_ssm_final.py 2022-08-06 10:04:45.744669942 -0600
@@ -344,6 +344,14 @@
client = self._get_boto_client('ssm', region_name=region_name, profile_name=profile_name)
self._client = client
response = client.start_session(Target=self.instance_id, Parameters=ssm_parameters)
+
+ # if self.is_windows:
+ # ssm_parameters = dict()
+ # response = client.start_session(Target=self.instance_id, Parameters=ssm_parameters)
@kedwards
kedwards / gpg.md
Last active June 16, 2022 10:19
GPG

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date: