Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
I am a turtle

Riccardo M. Cefala riccardomc

🐢
I am a turtle
View GitHub Profile
@riccardomc
riccardomc / argo.sh
Created Jul 7, 2020
do things in argo without browser
View argo.sh
# FIXME: argocd-server default password is the podname, should we use proper secrets?
ARGOCD_PASSWORD=$(kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2)
# How many seconds to wait for cluster services to be up before giving up. 600s = 10mins.
ARGOCD_TIMEOUT=600
# login to argocd server using port forward
argocd login \
--insecure \
--port-forward \
--port-forward-namespace argocd \
@riccardomc
riccardomc / oidc-thumbprint-regions.sh
Created Nov 28, 2019
Extract OIDC provider thumbprint for all AWS Region with EKS support
View oidc-thumbprint-regions.sh
#!/bin/bash
set -e
if [ ! -z "$DEBUG" ] ; then
set -x
fi
REGIONS="us-east-2
us-east-1
@riccardomc
riccardomc / oidc-thumbprint.sh
Created Nov 28, 2019
Extract OIDC provider thumbprint given an AWS EKS cluster name
View oidc-thumbprint.sh
#!/bin/bash
set -e
if [ ! -z "$DEBUG" ] ; then
set -x
fi
CLUSTER_NAME=$1
@riccardomc
riccardomc / sqsfifo.sh
Created Nov 29, 2018
Use AWS SQS as a FIFO queue
View sqsfifo.sh
#!/bin/bash
#
# SQS Fifo
#
#aws sqs create-queue --queue-name q.fifo --attributes FifoQueue=true
queue=https://eu-west-1.queue.amazonaws.com/12345678910/q.fifo
pop() {
message=$(aws sqs receive-message --queue-url $queue --query 'Messages[0]')
@riccardomc
riccardomc / dns.go
Created Nov 29, 2018
Minimal DNS proxy in golang. Reply NXDOMAIN for AAAA queries.
View dns.go
package main
import (
"log"
"net"
"os"
"strconv"
"github.com/miekg/dns"
)
@riccardomc
riccardomc / checkecr2.sh
Created Nov 29, 2018
Delete older images in AWS ECR
View checkecr2.sh
#!/bin/bash
#
# Go through every repository and delete N older images where N > $LIMIT
#
# i.e. LIMIT=700 ./checkecr2.sh
#
set -e
# Limit
@riccardomc
riccardomc / checkecr.sh
Created May 31, 2018
Quick and dirty script to check the number of images in ECR repositories and if there is an associated lifecycle policy
View checkecr.sh
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
REPOS=$(aws ecr describe-repositories --query 'repositories[*].repositoryName' | jq -r '.[]')
for r in $REPOS ; do
printf $r
You can’t perform that action at this time.