Skip to content

Instantly share code, notes, and snippets.

View marcelobrake's full-sized avatar
🔥

Marcelo Divaldo Brake marcelobrake

🔥
View GitHub Profile
@marcelobrake
marcelobrake / check_top50_execution_time_on_mssql.sql
Created January 24, 2024 13:08
[MSSQL] Top 50 - Tempo de execução
SELECT TOP 50
st.text,
SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
((CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset
END - qs.statement_start_offset)/2) + 1
) AS statement_text,
qp.query_plan,
qs.execution_count,
@marcelobrake
marcelobrake / .env
Created May 4, 2023 14:56
.env file for idiots robots scanning my servers
YOUR=idiot
@marcelobrake
marcelobrake / nginx-tuning.md
Created June 30, 2022 12:04 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@marcelobrake
marcelobrake / arduino_temp_web.ino
Last active June 8, 2022 11:49
[ARDUINO] Enviar temperatura e umidade para API RESTFul
#include <DHT.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 88, 2);
IPAddress myDns(192, 168, 88, 1);
@marcelobrake
marcelobrake / flush-dns-cache-ubuntu.md
Created February 19, 2022 14:02
Flush DNS Cache #dns #cache #ubuntu #flushcache
sudo systemd-resolve --flush-caches

or

sudo /etc/init.d/dns-clean start

sudo systemd-resolve --statistics
@marcelobrake
marcelobrake / MinimumAutoScalingClusterPermissions.js
Created May 21, 2020 22:39
Minimum Permissions for AutoScalling on AWS with KOPS
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeAutoScalingInstances",
"autoscaling:DescribeLaunchConfigurations",
"autoscaling:SetDesiredCapacity",
@marcelobrake
marcelobrake / backup_restore_mssql_rds_s3.md
Last active April 30, 2020 11:56
Backup/Restore SQL Server on RDS to S3 #AWS #RDS #S3 #MSSQL

Para fazer um backup/restore do banco SQL Server do RDS em um bucket S3 será necessário executar os seguintes passos:

  1. Criar o bucket no S3 na mesma região onde está o banco (ex: Conta: My_Account, região: sa-east-1, bucket: my-backup-bucket)
  2. No RDS, criar ou editar um "Option Group" adicionando a opção SQLSERVER_BACKUP_RESTORE, setando o bucket em questão

Comando para iniciar o backup (substitua com os valores nas variáveis)

USE [msdb]
GO
@marcelobrake
marcelobrake / .zshrc
Created March 31, 2020 20:34 — forked from diego3g/.zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export ANDROID_HOME=~/Android/Sdk
export PATH="$PATH:$ANDROID_HOME/tools"
export PATH="$PATH:$ANDROID_HOME/platform-tools"
# Path to your oh-my-zsh installation.
export ZSH="/Users/diegofernandes/.oh-my-zsh"
export PATH="$PATH:/usr/local/bin"
@marcelobrake
marcelobrake / install-pptp-vpn-server.sh
Created March 16, 2020 15:27 — forked from moeiscool/install-pptp-vpn-server.sh
Install PPPTP VPN Server on Ubuntu 18.04
echo "======================="
echo "Installing PPTP VPN Server..."
echo "======================="
apt install pptpd -y
echo "Setting VPN Server IP : localip 172.16.0.1"
if grep -q "localip 172.16.0.1" /etc/pptpd.conf; then
echo "Already set."
else
sed -i 's/localip/#localip/g' /etc/pptpd.conf
echo "localip 172.16.0.1" >> /etc/pptpd.conf
@marcelobrake
marcelobrake / install-kubernetes-dashboard.md
Last active October 15, 2020 20:35
Install Kubernetes Dashboard

Install Kubernetes Dashboard

Instalando

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.4/aio/deploy/recommended.yaml

kubectl create serviceaccount dashboard-admin-sa
kubectl create clusterrolebinding dashboard-admin-sa --clusterrole=cluster-admin --serviceaccount=default:dashboard-admin-sa