Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View calexandre's full-sized avatar
:shipit:
🤘

Carlos Alexandre calexandre

:shipit:
🤘
View GitHub Profile
@calexandre
calexandre / merge-zsh-history.sh
Last active April 3, 2024 14:11
Merge two zsh history files
#!/bin/bash
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/
set -e
history1=$1
history2=$2
merged=$3
echo "Merging history files: $history1 + $history2"
test ! -f $history1 && echo "File $history1 not found" && exit 1
@calexandre
calexandre / script.js
Last active February 11, 2024 13:42
script para acelerar o processo de classificação no site e-factura (usado em 2022)
/* Como executar:td:icontains
* Abrir o site na página das faturas a classificar e abrir a consola javascript nas DevTools.
* Copy & Paste do código js e executar para cada página
*/
// comparação case insensitive
jQuery.expr[':'].icontains = function(a, i, m) {
return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
};
@calexandre
calexandre / azurerm-find-private-endpoint-zones.tf
Last active December 19, 2022 16:43
azurerm-find-private-endpoint-zones.tf
locals {
azurerm_private_endpoint = {
custom_dns_configs = [
{
"fqdn" = "something.westeurope.data.azurecr.io"
"ip_addresses" = [
"10.10.10.202"
]
},
{
@calexandre
calexandre / main.tf
Created December 4, 2022 18:25
terraform code to get all GCP shared-vpc service-projects attached to a particular host-project
# instructions:
# on the first run you to target apply otherwise terraform will complain with for_each
# 1. terraform apply -target='null_resource.projects'
# 2. terraform apply
terraform {
required_providers {
google = {
source = "hashicorp/google"
}
@calexandre
calexandre / external-dns_and_cert-manager.tf
Created April 14, 2022 15:18
ExternalDNS + CertManager helm chart terraform
## deploys the external-dns - https://github.com/kubernetes-sigs/external-dns
## view latest version: helm search repo external-dns/external-dns
## view possible values: helm inspect values external-dns/external-dns
resource "helm_release" "external_dns" {
name = "external-dns"
repository = "https://kubernetes-sigs.github.io/external-dns"
chart = "external-dns"
version = "1.8.0"
namespace = "external-dns"
@calexandre
calexandre / validate-webhook.sh
Created April 1, 2022 09:21
dvaz script to validate if k8s `mutating/validating` webhooks have their SAN configured or not
#!/bin/sh
MUTATING_WEBHOOKS=($(kubectl get mutatingwebhookconfiguration -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'))
VALIDATING_WEBHOOKS=($(kubectl get validatingwebhookconfigurations -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'))
# Check Mutating WebHooks
echo ":: Checking Mutating WebHooks ::"
echo "::____________________________::"
@calexandre
calexandre / readme.md
Last active February 8, 2022 15:12
Tasmota Cheat Sheet
@calexandre
calexandre / main.tf
Last active August 20, 2021 13:12
GCP DNS mass creation with Terraform
locals {
# the default is important in case you need it elsewhere (it points to the first zone created)
dns_default_zone = "my-dns-zone"
dns_default_fqdn = "${local.dns_default_zone}.${data.google_dns_managed_zone.parent[local.dns_default_zone].dns_name}"
dns_zones = {
"${local.dns_default_zone}" = {
parent_zone_name = "my-parent-dns-zone"
}
}
}
@calexandre
calexandre / scoop-packages.ps1
Last active September 2, 2020 12:22
My windows scoop packages
# Add scoop buckets
scoop bucket add extras
scoop bucket add scoop-completion https://github.com/Moeologist/scoop-completion
# Install scoop packages
scoop install 7zip
scoop install starship
scoop install keepass
scoop install keepass-plugin-keeanywhere
scoop install openssl
@calexandre
calexandre / Microsoft.PowerShell_profile.ps1
Created September 2, 2020 12:17
My powershell profile
Invoke-Expression (&starship init powershell)
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
# enable completion in current shell, use absolute path because PowerShell Core not respect $env:PSModulePath
Import-Module "$($(Get-Item $(Get-Command scoop).Path).Directory.Parent.FullName)\modules\scoop-completion"