Skip to content

Instantly share code, notes, and snippets.

View vadirajks's full-sized avatar

Vadiraj K.S vadirajks

View GitHub Profile
@Prajithp
Prajithp / aws-cli-filtering.md
Created July 16, 2018 14:56 — forked from carlessanagustin/aws-cli-filtering.md
Filtering AWS results

Via AWS CLI using jq

(https://github.com/mwilliamson/jq.py)

aws ec2 describe-instances | jq '.Reservations[].Instances[] | select(.KeyName == "MyKey") | select(.State.Code != 48) | select(.Tags[]|select(.Key=="Name")|select(.Value=="InstanceName")) | [ .PublicIpAddress]'
 
aws ec2 describe-instances | jq '.Reservations[].Instances[] | select(.KeyName == "MyKey") | select(.State.Code != 48) | select(.Tags[]|select(.Key=="Name")|select(.Value=="InstanceName")) | [ .PublicIpAddress, (.Tags[]|select(.Key=="Name").Value)]'

aws ec2 describe-instances | jq '.Reservations[].Instances[] | select(.KeyName == "MyKey") | select(.State.Code != 48) | select(.Tags[]|select(.Key=="InventoryGroup").Value) | [ .PublicIpAddress, (.Tags[]|select(.Key=="Name").Value)]'
@yanndegat
yanndegat / ec2ansibleinv.sh
Created April 28, 2017 11:26
ec2 instances to ansible inventory using jq
#!/bin/bash
STACK=$1
aws ec2 describe-instances | jq -r \
'[
.Reservations[].Instances[]
| . as $node
| {
ip: ($node.NetworkInterfaces[0].PrivateIpAddress),
name: ($node.Tags[] | select(.Key == "Name").Value),
@bastman
bastman / aws-cli-cognito-get-open-id-token-for-developer-identity.md
Last active May 2, 2021 15:43
aws cognito examples (bash / php): custom auth provider

Aws Cognito: Custom Auth (Developer Authenticated Identities)

How to get OpenID Token & IdentityId from AWS Cognito?

  • example: using bash (aws cli sdk)
  • example: using php (aws php sdk v3.*)

note

  • you need to add example.com as custom auth provider in aws console (cognito/federated)
@dboyd13
dboyd13 / aws-solution-architect-associate-study-notes
Last active October 29, 2021 03:21
AWS Solution Architect Associate Study Notes (Late 2017, Early 2018)
___ _____ ___ _ _ _ _ _ _ _ _ _ _ _
/_\ \ / / __| ___ / __| ___| |_ _| |_(_)___ _ _ /_\ _ _ __| |_ (_) |_ ___ __| |_ /_\ ______ ___ __(_)__ _| |_ ___
/ _ \ \/\/ /\__ \ |___| \__ \/ _ \ | || | _| / _ \ ' \ / _ \| '_/ _| ' \| | _/ -_) _| _| / _ \ (_-<_-</ _ \/ _| / _` | _/ -_)
/_/ \_\_/\_/ |___/ |___/\___/_|\_,_|\__|_\___/_||_| /_/ \_\_| \__|_||_|_|\__\___\__|\__| /_/ \_\/__/__/\___/\__|_\__,_|\__\___|
Notes taken between Dec-2017 and Jan-2018, from acloud.guru and AWS FAQs.
Solution Architect Associate - Need to Know:
@mikesparr
mikesparr / gcp-shared-vpc-multi-env.sh
Last active April 9, 2022 12:46
Example multi-env secure setup with Argo CD and Argo Rollouts
#!/usr/bin/env bash
# REF: https://cloud.google.com/docs/enterprise/best-practices-for-enterprise-organizations
export PROJECT_ID=$(gcloud config get-value project)
export PROJECT_USER=$(gcloud config get-value core/account) # set current user
export PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
export IDNS=${PROJECT_ID}.svc.id.goog # workflow identity domain
export GCP_REGION="us-west4" # CHANGEME (OPT)
@jona7o
jona7o / initCognitoUser.sh
Created February 22, 2019 18:10
Bash script for the following cognito workflow: Sign Up User with Username and Mail --> Confirm User --> Login User --> Print Access Token
#!/bin/bash
debug=0
if [[ $# -eq 0 ]] ; then
echo 'usage: initCognitoUser [parameters]'
echo 'paramters:'
echo '-c --clientId: Cognito ClientId'
echo '-i --poolId: Cognito UserPoolId'
echo '-u --username: Username of new User'
echo '-p --password: Password of new User'
@zodvik
zodvik / benchmark-commands.txt
Last active December 18, 2022 12:45
Kafka (1.0.0) Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper localhost:2181/kafka-local --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper localhost:2181/kafka-local --create --topic test-rep-two --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.tools.ProducerPerformance --print-metrics --topic test-rep-one --num-records 6000000 --throughput 100000 --record-size 100 --producer-props bootstrap.servers=kafka_host:9092 buffer.memory=67108864 batch.size=8196
Single-thread, async 3x replication
@lukecav
lukecav / wordpress.conf
Last active January 10, 2023 13:44
Docker image with Nginx front-end for WordPress PHP-FPM image - Updated NGNIX config - includes updated expires headers, browser caching and Gzip enabled.
# WordPress single site rules.
# Designed to be included in any server {} block.
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
@jrfnl
jrfnl / _readme.md
Last active June 4, 2023 17:12
PHPUnit xslt

###PHPUnit logfile XLST template

This fileset provides an easy way to view the PHPUnit XML (JUnit) logfiles in a human readable manner using a web browser.

Use this either in combination with the accompanying html file or add the following tag straight after the xml opening tag of the logfile: <?xml-stylesheet type="text/xsl" href="phpunit.xslt"?>

The thresholds used for the colour-coding and whether or not to show detail for successfull tests can be changed by adjusting the variables at the top of the xslt file.

@mik-laj
mik-laj / a.sh
Last active June 19, 2023 20:13
API Request to GKE cluster using curl
GCP_CLUSTER_NAME=europe-west1-fluffy-bcad8335-gke
GCP_CLUSTER_ZONE=europe-west1-b
curl --cacert <(gcloud container clusters describe "${GCP_CLUSTER_NAME}" \
--zone "${GCP_CLUSTER_ZONE}" \
--format='value(masterAuth.clusterCaCertificate)' | base64 -d\
) \
--header "Authorization: Bearer $(gcloud auth print-access-token)" \
https://$(gcloud container clusters describe "${GCP_CLUSTER_NAME}" \
--zone "${GCP_CLUSTER_ZONE}" \