Skip to content

Instantly share code, notes, and snippets.

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

Jhon jhowbhz

🦾
Um programador apaixonado pelo que faz
View GitHub Profile
@jhowbhz
jhowbhz / clear docker
Last active December 19, 2024 02:56
Clear all docker overlays
docker rm -vf $(docker ps -aq)
docker rmi -f $(docker images -aq)
docker volume prune -f
// DOT NOT USE IS COMMAND IN PRODUCTION //
// IS ERASE YOUR FILES! AND VOLUMES! //
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
docker rmi -f $(docker images -q)
@jhowbhz
jhowbhz / monitoring.sh
Created January 6, 2024 04:04
Monitoring script for apibrasil
#! /bin/bash
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 'https://gateway.apibrasil.io/api/v2/whatsapp/sendText' \
--header 'Content-Type: application/json' \
--header 'DeviceToken: YOUR_DEVICE_TOKEN' \
@jhowbhz
jhowbhz / firewall.sh
Created December 29, 2023 19:28
Liberar firewall SaveIncloud Todas as Portas
# instala persiste
sudo apt-get install iptables-persistent
# lista portas
sudo iptables -L
# libera tudo
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
@jhowbhz
jhowbhz / wif+bluetooth.io
Created December 21, 2023 22:33
Wifi + Bluetooth ESP32-CAM
/*
* This sketch demonstrates how to scan WiFi networks.
* The API is almost the same as with the WiFi Shield library,
* the most obvious difference being the different file you need to include:
*/
#include "WiFi.h"
#include "BluetoothSerial.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
@jhowbhz
jhowbhz / load-wifi.ino
Created December 21, 2023 22:32
Load wifi ESP32-CAM
#include "WiFi.h"
void setup()
{
Serial.begin(115200);
// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
@jhowbhz
jhowbhz / create_google_api_credentials.md
Created October 18, 2023 23:16
Create Google API credentials in 50 easy steps

Create Google API credentials in 50 easy steps

Google has made it really easy to create api credentials for own use, just follow these few steps:

  1. Go to Google Cloud Console
  2. Create a new project (or select an existing) from the menu [screenshot]
  3. Search for drive api in the search bar and select Google drive api under the marketplace section [screenshot]
  4. Click to enable Google Drive API button [screenshot]
  5. Click on the Credentials menu item
  6. Click on the Configure Consent Screen button [screenshot]
@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