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 / install.md
Last active April 9, 2024 18:20
Install PHP 8.3 - FPM Nginx Ubuntu 22.04

Add Ondrej's PPA

sudo add-apt-repository ppa:ondrej/php 
sudo apt update
@jhowbhz
jhowbhz / install.sh
Last active April 9, 2024 17:24
Install docker ubuntu 22.04
sudo apt update && sudo apt install apt-transport-https ca-certificates curl software-properties-common &&
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg &&
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && apt update -y
sudo apt install docker-ce -y
sudo systemctl status docker
@jhowbhz
jhowbhz / supervisor.sh
Created March 8, 2024 18:38
Supervisor config file
# how to install supervisor
apt install supervisor
# how to create config file supervisor
nano /etc/supervisor/conf.d/laravel-worker.conf
# set text in file, save and restart service
# service supervisor restart
[program:laravel-worker]
@jhowbhz
jhowbhz / find.sh
Created March 7, 2024 02:41
Find big files in linux terminal
find / -type f -size +1G -exec du -h {} + | sort -rh | head -n 1
@jhowbhz
jhowbhz / clear docker
Created March 6, 2024 21:54
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! //
@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]