Skip to content

Instantly share code, notes, and snippets.

View thiagobrabo's full-sized avatar
💭
"vivendo e aprendendo a jogar..."

thiagobrabo

💭
"vivendo e aprendendo a jogar..."
View GitHub Profile
@thiagobrabo
thiagobrabo / nginx.conf
Created November 22, 2019 17:47 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@thiagobrabo
thiagobrabo / k9s-setup.sh
Last active March 31, 2023 02:43
Install k9s
cd ~
curl -L https://github.com/derailed/k9s/releases/download/v0.21.4/k9s_Linux_x86_64.tar.gz -o k9s
tar -xf k9s
chmod +x k9s
sudo mv ./k9s /usr/local/bin/k9s
k9s
or
clone repo: [email protected]:derailed/k9s.git
# Install script for Octadesk
# Created 01.12.2021
ECHO Active Windows Features
ECHO Configure chocolatey
choco feature enable -n allowGlobalConfirmation
#WINDOWS FEATURES
choco install TelnetClient -y -source windowsfeatures
@thiagobrabo
thiagobrabo / kubernetes_commands.md
Last active September 15, 2023 13:17 — forked from houstondapaz/kubernetes_commands.md
comandos de ajuda para trabalhar com kubernets

Deletar evicted pods

kubectl get pods -n NAMESPACE | grep Evicted | awk '{print $1}' | xargs kubectl delete pod -n NAMESPACE
ou
kgp | grep Evicted | awk '{print $1}' | xargs kubectl delete pod

Deletar pods em crash

kubectl delete pod -n NAMESPACE `kubectl get pods -n NAMESPACE | awk '$3 == "CrashLoopBackOff" {print $1}'`
@thiagobrabo
thiagobrabo / disk-checker.yaml
Last active September 15, 2023 14:34
DaemonSet deploy disk node checker, use for troubleshooting evicted pod error by node disk pressure.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: disk-checker
labels:
app: disk-checker
spec:
selector:
matchLabels:
app: disk-checker
@thiagobrabo
thiagobrabo / gist:8a437aba49905b9c690621f67132ff58
Last active December 14, 2023 00:15
mongodb list top collections size
function getTopCollectionSizes(limit = 10) {
let counter = 0;
db.getCollectionNames().map(function(name) {
let collectionStats = db.getCollection(name).stats();
let sizeInMB = (collectionStats["size"] / (1024 * 1024)).toFixed(2); // Convert bytes to megabytes
let storageSizeInMB = (collectionStats["storageSize"] / (1024 * 1024)).toFixed(2); // Convert bytes to megabytes
return {
"name": name,
@thiagobrabo
thiagobrabo / gist:d36e6defdefe0c1abcd113dd85c83905
Created November 4, 2023 05:57
Reclaim Disk Space from MongoDB
1 - Applies to MongoDB 3.2 or better and all following operations run on Mongo Shell.
You need to confirm your Mongo’s engine is WiredTiger:
```sh
db.serverStatus().storageEngine
// expect output: { "name" : "wiredTiger" }
```
2 - Now, execucute show dbs to locate the biggest databases, and then locate the biggest collections execxute:
```sh
@thiagobrabo
thiagobrabo / README-Template.md
Last active April 9, 2024 01:13 — forked from DomPizzie/README-Template.md
A simple README.md template

Project Title

Simple overview of use/purpose.

Description

An in-depth paragraph about your project and overview of use.

Built With

@thiagobrabo
thiagobrabo / !renew-certificate.sh
Created April 9, 2024 18:36 — forked from rasschaert/!renew-certificate.sh
Automatic renewal of let's encrypt certificates using docker containers and luadns
#!/bin/bash
# Set PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Run the certbot container to renew the certs
docker-compose -f /opt/docker/certbot/docker-compose.yml run --rm certbot
# Concatenate the resulting certificate chain and the private key and write it to HAProxy's certificate file.
cat /opt/docker/certbot/certbot/etc/letsencrypt/live/example.org/{fullchain,privkey}.pem > /opt/docker/haproxy/ssl/example_org.pem
Esta seção contém os comandos equivalentes entre estes dois sistemas e a avaliação entre ambos. Grande parte dos comandos podem ser usados da mesma forma que no DOS, mas os comandos Linux possuem avanços para utilização neste ambiente multiusuário/multitarefa.
DOS Linux Diferenças
-------- ------------ --------------------------------------------------
cls clear Sem diferenças.
dir ls -la A listagem no Linux possui mais campos (as
permissões de acesso) e o total de espaço ocupado
no diretório e livre no disco deve ser visto
separadamente usando o comando du e df.
Permite também listar o conteúdo de diversos