Skip to content

Instantly share code, notes, and snippets.

View edtshuma's full-sized avatar

Ed Tshuma edtshuma

View GitHub Profile
@edtshuma
edtshuma / HOWTO_mailx.sh
Created August 22, 2023 06:42 — forked from ppdeassis/HOWTO_mailx.sh
Setting up mailx to send mail from command line using external server
# ref: https://coderwall.com/p/ez1x2w/send-mail-like-a-boss
# install mailx
yum -y install mailx
# create a directory with a certificate, to send mail using TLS
mkdir ~/.certs
certutil -N -d ~/.cert
# create a user ~/.mailrc, to use custom settings
@edtshuma
edtshuma / monitor_ec2_instance.py
Created June 9, 2023 12:44 — forked from si3mshady/monitor_ec2_instance.py
Setting Up CloudWatch Alarms with Boto3 to Monitor EC2 Instance Performance
import boto3
# Specify the region where the EC2 instances reside
region = 'us-east-1'
# Specify the tag key and value to filter the EC2 instances
tag_key = 'env'
tag_value = 'prod'
@edtshuma
edtshuma / http_requests.py
Created May 22, 2023 06:32 — forked from bpgould/http_requests.py
async python http requests using exponential backoff, jitter, and event logging
"""
This module provides functionality for making HTTP requests. It leverages the `aiohttp`
library for asynchronous HTTP requests, and the `backoff` library to implement exponential
backoff in case of failed requests.
The module defines a child logger for logging purposes and implements two methods, `on_backoff`
and `on_giveup`, which log information about the retry attempts and when the retry attempts are
given up respectively.
The `http_request` function is the primary function of the module, making an HTTP request with the
@edtshuma
edtshuma / config.tf
Created April 8, 2023 16:49 — forked from kerr-bighealth/config.tf
iam-user module
terraform {
required_version = ">=0.12, <0.13"
}
@edtshuma
edtshuma / ssh-password.md
Created October 17, 2022 06:37 — forked from cmbaughman/ssh-password.md
SSH Passwords

How to set up passwordless ssh,scp, and rsync

Setup

  1. Install the application sshpass:
sudo apt install sshpass
  1. Make sure to set in your ~/.ssh/config file the following options to prevent ssh from using your pubkey:
@edtshuma
edtshuma / workspaces_ec2_s3_deploy.tf
Created September 10, 2022 11:04 — forked from si3mshady/workspaces_ec2_s3_deploy.tf
Terraform workspaces and variables practice - deploy ec2 and s3
terraform {
backend "s3" {
bucket = "elliott-arnold-dev-bucket"
region = "us-east-1"
key= "tfstate"
}
}
@edtshuma
edtshuma / error_count_kubectl.awk
Created August 17, 2022 09:51 — forked from si3mshady/error_count_kubectl.awk
AWK practice - filter kubectl output to show counts for running, errorImagePull and imagePullBackup
BEGIN {
imagePullBackOff=0
running=0
errorImagePull=0
}
{
@edtshuma
edtshuma / gist:28a6e6976752ce8d7ba4d3d6f1e778a9
Created August 8, 2022 07:34 — forked from mrlesmithjr/gist:72e23d0a0cceefef553b83b4fce5d06f
Example GitLab CI Pipeline using Terraform, etc.
---
# Most pre-req tooling, etc. is installed using jumphosts.yml playbook
variables:
ADMIN_EMAIL: mrlesmithjr@gmail.com
CLOUD_PROVIDER: Azure # Define Supported Cloud Provider (Azure)
GIT_CRYPT_ENABLED: "true" # Must be lowercase (true|false)
GIT_SUBMODULE_STRATEGY: recursive
ORGANIZATION: example_org
PROJECT_NAME: example_project
TERRAFORM_VERSION: 0.12.28
@edtshuma
edtshuma / get_deployment_manifest.sh
Created August 4, 2022 15:25 — forked from si3mshady/get_deployment_manifest.sh
Generate k8s deployment manifest files after using helm
for dep in $(kubectl get deployment | awk '{print $1}'); do kubectl get deployment $dep -o yaml > $dep.yml; done
@edtshuma
edtshuma / gist:c4ec63db997723f9e9c35ed3d5a5c80e
Last active December 9, 2020 13:48 — forked from hayderimran7/gist:78421229af85ae90177b
So what is the 'credentials-id' parameter and how to use it correctly in jenkins-job-builder yaml file of your job?
It took me a while, after multiple knocks on all openstack/cloudbees/jenkins IRCs and googling around, all of them proved to be fruitless that I finally figure what the deal about this parameter all about?
before posting the exact details, i just have a little rant : WHY IS THIS NOT IN THE DOCS OF JENKINS JOB BUILDER (JJB ) ???
Jenkins job builder docs are pretty concise and dont go into much details,
but anyway:
=================================
what is credentials-id parameter?
=================================
so you are writing a yaml file for your job 'foo.yaml' and you need to use a git repo, lets say its in github,
now github private repos are snowflaky where you need to provide credentials to github in order to clone them. Following is step-by-step howto: