Skip to content

Instantly share code, notes, and snippets.

@klapcsik
klapcsik / jenkins-plugins.md
Created September 22, 2022 07:03 — forked from noqcks/jenkins-plugins.md
How to get a complete plugin list from jenkins (with version)

I need a way to get a list of plugins so that I can use them with docker jenkins in the format <plugin>: <version>

1. get the jenkins cli.

The jenkins CLI will allow us to interact with our jenkins server from the command line. We can get it with a simple curl call.

curl 'localhost:8080/jnlpJars/jenkins-cli.jar' > jenkins-cli.jar
#!/usr/bin/env bash
usage="Usage: $(basename "$0") region stack-name [aws-cli-opts]
where:
region - the AWS region
stack-name - the stack name
aws-cli-opts - extra options passed directly to create-stack/update-stack
"
@klapcsik
klapcsik / loop.sh
Created July 22, 2022 10:29 — forked from z0ph/loop.sh
Loop on put alternate contacts across AWS Org
#!/bin/bash
# https://awscli.amazonaws.com/v2/documentation/api/latest/reference/account/put-alternate-contact.html
# Parameters
SECURITY_EMAIL="victor@zoph.io"
SECURITY_PHONE=""
SECURITY_TITLE="Owner"
SECURITY_NAME="Victor Grenu"
@klapcsik
klapcsik / find_user_from_access_key.py
Created June 22, 2022 11:17 — forked from andymotta/find_user_from_access_key.py
Find an AWS IAM user corresponding to an AWS Access Key (boto3)
# Find the IAM username belonging to the TARGET_ACCESS_KEY
import boto3
from botocore.exceptions import ClientError
iam = boto3.client('iam')
def find_user(key):
try:
key_info = iam.get_access_key_last_used(AccessKeyId=key)
@klapcsik
klapcsik / gist:917c4117aad226e454088a21f15259e7
Created June 22, 2022 11:13 — forked from xxxVxxx/gist:9648264fd6f41bbb1f65
boto3 aws find all IAM accesskeys details for the account
import boto3
boto3.setup_default_session(profile_name='IAM')
resource = boto3.resource('iam')
client = boto3.client("iam")
KEY = 'LastUsedDate'
for user in resource.users.all():
# Source: https://gist.github.com/6fb3e7da327df9203d9d4c184fcb5831
##############################################################################
# Combining Argo CD (GitOps), Crossplane (Control Plane), And Kubevela (OAM) #
# https://youtu.be/eEcgn_gU3SM #
##############################################################################
# Referenced videos:
# - Argo CD - Applying GitOps Principles To Manage Production Environment In Kubernetes: https://youtu.be/vpWQeoaiRM4
# - Cloud-Native Apps With Open Application Model (OAM) And KubeVela: https://youtu.be/2CBu6sOTtwk
# Source: https://gist.github.com/f0d35ef2260208b15ddd390007fdd552
######################################################################
# Production-Ready Kubernetes Clusters Using Crossplane Compositions #
# https://youtu.be/uMC2QQfMctg #
######################################################################
# Referenced videos:
# - Crossplane - GitOps-based Infrastructure as Code through Kubernetes API: https://youtu.be/n8KjVmuHm7A
# - How To Shift Left Infrastructure Management Using Crossplane Composites: https://youtu.be/AtbS1u2j7po
# Source: https://gist.github.com/a156975ae372bf15284e15c489aab4aa
##########################################################################
# Crossplane #
# Using Kubernetes API and GitOps to manage Infrastructure as Code (IaC) #
# https://youtu.be/n8KjVmuHm7A #
##########################################################################
# Referenced videos:
# - Argo CD - Applying GitOps Principles To Manage Production Environment In Kubernetes: https://youtu.be/vpWQeoaiRM4
@klapcsik
klapcsik / aws-cli.sh
Created May 7, 2022 09:20 — forked from devasat/aws-cli.sh
AWS CLI Examples
# ********** EC2 ***********
# describe ec2 instances
aws ec2 describe-instances \
--query 'Reservations[*].Instances[*].[InstanceId,Tags[?Key==`Name`].Value|[0],State.Name,
PrivateIpAddress,PublicIpAddress]' \
--output table
# stopped instances
@klapcsik
klapcsik / list-rds-instances.sh
Created May 7, 2022 09:08 — forked from joerx/list-rds-instances.sh
List RDS instances, select some fields and render as CSV with aws cli, bash and jq
#!/bin/sh
if [ "$INSTANCE" == "" ]; then
CMD="aws rds describe-db-instances"
else
CMD="aws rds describe-db-instances --db-instance-identifier=$INSTANCE"
fi
echo '"DBInstanceIdentifier","DBInstanceStatus","DBInstanceClass"'