Skip to content

Instantly share code, notes, and snippets.

View itxtoledo's full-sized avatar
🏠
Working from home

Gustavo itxtoledo

🏠
Working from home
View GitHub Profile
@itxtoledo
itxtoledo / smtp-config-schema.json
Created December 4, 2024 20:44
JSON Schema for validating SMTP configurations. This schema ensures that each configuration in an array contains the required properties (host, port, user, and pass) with the correct data types and disallows additional properties.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"type": "object",
"properties": {
"host": {
"type": "string"
},
"port": {
@itxtoledo
itxtoledo / gerar_resumo_de_noticias_ia.js
Created March 23, 2024 22:52
Script para gerar resumo das melhores noticias do site The Defiant e obter um resumo do mercado pela api do Coinsamba
import Parser from "rss-parser";
import OpenAI from "openai";
import axios from "axios";
import clipboardy from "clipboardy";
let parser = new Parser();
const api = new OpenAI({
apiKey: "paste_here",
});
@itxtoledo
itxtoledo / Dockerfile
Created December 23, 2023 03:00
Dockerfile nodejs yarn
FROM node:18.0.0-alpine
ARG SSH_KEY
RUN apk add --no-cache dumb-init
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
WORKDIR /usr/src/app
@itxtoledo
itxtoledo / pearson.html
Created February 9, 2021 14:30
Correlação de Pearson em JavaScript
<html>
<head>
<meta charset="utf-8">
<title>Correlação de Pearson</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
</head>
@itxtoledo
itxtoledo / pmginx.sh
Last active June 13, 2020 23:31
Instalar pacotes para deploy de uma API Node.js com NGINX e PM2
#!/bin/bash
# executar com sudo
# wget -O - thisUrl | bash
apt-get install apt-transport-https -y
apt-get update -y && apt-get upgrade -y && apt-get install curl -y
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
@itxtoledo
itxtoledo / rabbitmq-install.sh
Last active December 23, 2019 15:13
RabbitMQ Install Script, tested on Ubuntu 16.04
#! /bin/bash
# sudo curl -s https://gist.githubusercontent.com/xxx/xxx/raw/3xxx/rabbitmq-install.sh | bash -s
rabbit_deb=rabbitmq-server_3.6.15-1_all.deb
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.15/"$rabbit_deb"
dpkg -i "$rabbit_deb"
sudo apt-get -f -y install
rm "$rabbit_deb"
#rabbitmq wants this dir in ubuntu, but things should work without it exist
sudo mkdir /etc/rabbitmq/rabbitmq.conf.d