Skip to content

Instantly share code, notes, and snippets.

View jhowbhz's full-sized avatar
:shipit:
Um programador apaixonado pelo que faz

Jonathan Henrique jhowbhz

:shipit:
Um programador apaixonado pelo que faz
View GitHub Profile
@jhowbhz
jhowbhz / csv-mysql.py
Last active October 17, 2023 16:05
CSV to MYSQL Create and Inserts
import pandas as pd
import mysql.connector
import os
import psutil
# Configurações do banco de dados
db_config = {
"host": "your_host",
"user": "your_user",
"password": "your_password",
@jhowbhz
jhowbhz / xlsx-mysql.py
Last active October 17, 2023 16:05
XLSX to MYSQL Create and Inserts
import pandas as pd
import mysql.connector
import os
import psutil
import openpyxl # Você precisa instalar essa biblioteca com 'pip install openpyxl'
# Configurações do banco de dados
db_config = {
"host": "your_host",
"user": "your_user",
@jhowbhz
jhowbhz / monitoring.sh
Last active January 6, 2024 04:04
Monitoring script sh
#! /bin/bash
# Add crontab -e line */1 * * * * /opt/resource.sh
MEMORY=$(free -m | awk 'NR==2{printf "%6.2f%%", $3*100/$2 }')
DISK=$(df -h | awk '$NF=="/"{printf "%6s", $5}')
CPU=$(top -bn1 | grep load | awk '{printf "%6.2f%%", $(NF-2)}')
MESSAGE="*Servidor*\n-----\n*Servidor:* APIS\n*Memória*: $MEMORY\n*Disco*:$DISK\n*CPU:*$CPU"
curl --location -g --request POST 'https://youserver.api/sendText' \
--header 'Content-Type: application/json' \
@jhowbhz
jhowbhz / examples.md
Last active June 27, 2023 16:18
PM2 Commands utils

Inicia com nome

pm2 start index.js --name="APP"

Reinicia a cada alteração dos arquivos

pm2 start index.js --watch

Lista as instancias

pm2 list

@jhowbhz
jhowbhz / exemplo_cnpj.html
Last active March 20, 2024 04:47
Busca dados CNPJ APIBRASIL
<!-- COMECE GRATIS AGORA APIBRASIL.COM.BR -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css" />
@jhowbhz
jhowbhz / PHP-FPM settings
Last active April 4, 2023 02:23
PHP-FPM settings
PHP-FPM settings tutorial. max_servers, min_servers, etc.
echo Cores = $(( $(lscpu | awk '/^Socket/{ print $2 }') * $(lscpu | awk '/^Core/{ print $4 }') ))
When you run the Linux command above, you will get something like “Cores = 4”.
ps --no-headers -o "rss,cmd" -C php-fpm7.2 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
When I ran the command above, I got 29M.
/etc/php/7.2/fpm/pool.d/www.conf
@jhowbhz
jhowbhz / install_package.sh
Created March 29, 2023 02:10
ping not found ubuntu
sudo apt install iputils-ping -y
@jhowbhz
jhowbhz / change_dns.sh
Created March 29, 2023 01:55
change dns netplan ubuntu 22.04
sudo nano /etc/netplan/00-install-config.yaml
sudo netplan apply
@jhowbhz
jhowbhz / trusted.gpg.d.txt
Last active November 29, 2023 22:24
fix linux errors trusted.gpg.d
cd /etc/apt
sudo cp trusted.gpg trusted.gpg.d
@jhowbhz
jhowbhz / url_files.json
Created March 26, 2023 14:11
Add aditional esp01 Arduino IDE
https://arduino.esp8266.com/stable/package_esp8266com_index.json