Skip to content

Instantly share code, notes, and snippets.

View sergsoares's full-sized avatar

Sergio Soares sergsoares

View GitHub Profile
@sergsoares
sergsoares / lxqt-rc.xml
Created March 26, 2022 14:07
Openbox configuration
<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file, it will be overwritten on install.
Copy the file to $HOME/.config/openbox/ instead. -->
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
<resistance>
<strength>10</strength>
<screen_edge_strength>20</screen_edge_strength>
</resistance>
<focus>
<focusNew>yes</focusNew>
@sergsoares
sergsoares / providers.tf
Created February 25, 2022 17:06
Example of Terraform providers configuration
terraform {
required_version = ">= 1.0.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
@sergsoares
sergsoares / get-ecr-image.sh
Created February 16, 2022 12:38
Get ECR image using split in shell
get-ecr-image(){
# Split URI in shell
splittedUri=(${1//./ })
# Get needed positions (account & region)
ACCOUNT=${splittedUri[0]} # account
REGION=${splittedUri[3]} # region
# Get ECR password & Login in ECR
aws ecr get-login-password --region ${REGION} | docker login --username AWS --password-stdin "${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com"
@sergsoares
sergsoares / bash.sh
Created January 29, 2022 19:53
Script to get all configmaps values being used in a Namespace
kubectl get configmap -o json -n namespace | jq '.items[] | [.metadata.namespace, .metadata.name, .data ]'
@sergsoares
sergsoares / bash.sh
Last active January 29, 2022 19:53
Script for get based on namespaces the secrets being used
#!/bin/bash
namespaces=(namespace1 namespace2)
env='dev.'
for namespace in "${namespaces[@]}"; do
echo '################################'
echo "# Namespace: ${namespace}"
echo '################################'
@sergsoares
sergsoares / template.yml
Created January 29, 2022 19:46
Kubernetes Manifest as example for External Name + Ingress (for Nginx)
apiVersion: v1
kind: Service
metadata:
name: my-service
namespace: default
spec:
type: ExternalName
externalName: google.com
---
apiVersion: networking.k8s.io/v1
@sergsoares
sergsoares / bash.sh{
Created January 29, 2022 19:43
Kube_prompt bash function to be used in shell (depends on kubectl plugin ctx and ns wiht krew)
alias k=kubectl
alias kubectx='kubectl ctx'
alias kctx='kubectl ctx'
alias kubens='kubectl ns'
alias kns='kubectl ns'
complete -F __start_kubectl k
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
@sergsoares
sergsoares / bash.sh
Created January 29, 2022 19:42
Aliases for terraform to be used with Terraform Visual
alias tp='terraform plan -out=plan.out'
alias tv='terraform show -json plan.out > plan.json && terraform-visual --plan plan.json && xdg-open terraform-visual-report/index.html'
alias tpv='terraform plan -out=plan.out && terraform show -json plan.out > plan.json && terraform-visual --plan plan.json && xdg-open terraform-visual-report/index.html'
alias tap='terraform apply plan.out'
@sergsoares
sergsoares / bash.sh
Created January 29, 2022 19:41
Snippet for extract compressed Files
x(){
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
@sergsoares
sergsoares / main.tf
Created December 8, 2021 20:43
Remove "https://" from OIDC provider URL for use as EKS assumeRole
data "aws_eks_cluster" "eks_cluster" {
name = var.eks_name
}
locals {
oidcprovider =replace(data.aws_eks_cluster.eks_cluster.identity[0].oidc[0].issuer,"/(https://)/","")
}