Skip to content

Instantly share code, notes, and snippets.

View arantesxyz's full-sized avatar
♥️
Coding your dreams

Gustavo Arantes arantesxyz

♥️
Coding your dreams
View GitHub Profile
@arantesxyz
arantesxyz / NoBungeeDirectConnect.java
Last active March 27, 2020 00:00
Block direct connections from bungee
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.event.ServerConnectEvent;
import net.md_5.bungee.api.event.ProxyPingEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.api.plugin.Plugin;
import net.md_5.bungee.event.EventHandler;
@arantesxyz
arantesxyz / pom.xml
Created April 10, 2020 22:46
Pom example
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dev.arantes.nameplugin</groupId>
<artifactId>Name</artifactId>
<version>1.0</version>
<description>plugin</description>
@arantesxyz
arantesxyz / reverse.c
Created April 17, 2020 18:35
Reverse string c
#include <stdio.h>
int main()
{
char s[50], r[50];
int c = 0;
int begin;
int end;
printf("Digite algo:\n");
@arantesxyz
arantesxyz / start.sh
Created June 1, 2020 04:07
Script to start a paper server easily
#!/bin/sh
VERSION=$1
if [ -z "$VERSION" ]
then
echo "Please specify a version! E.G. start 1.15.2"
exit 0;
fi
FILE=paper-$VERSION.jar
import time, numpy
# [1, 2, 9, 5, 8]
# {1, 2, 3, 3, 4}
def dynamic(arr):
size, pos = 0, [0] * len(arr)
for item in arr:
start, end = 0, size
@arantesxyz
arantesxyz / validade.js
Last active March 2, 2021 23:45
Function to validade javascript objects
/**
*
* @param {Any} object Any type to be validated
* @param {String/Array} required Type name to validade
* @param {Function} callback Optional function to be called instead of throwing the error
*/
function validade(object, required = [], callback) {
const type = [].concat(required).map((item) => item.toLowerCase());
if (object === null && type.includes("null")) return;
@arantesxyz
arantesxyz / SFTPCopyFiles.js
Created July 6, 2020 19:34
Copy files from one server to another
const Client = require("ssh2-sftp-client");
const fs = require("fs");
async function SFTPCopyFiles(
sourceData,
targetData,
{ debug = false, replace = true }
) {
// _validadeSFTPData(sourceData);
// _validadeSFTPData(targetData);
@arantesxyz
arantesxyz / Replacer.java
Last active May 26, 2022 01:36
Replacer instance to improve code readability when replacing a lot of different strings with the same pattern.
/**
* Replacer instance to improve code readability when replacing a lot of different strings with the same pattern.
*
* @Author Gustavo Arantes (https://arantes.dev/)
*/
public class Replacer {
private Map<CharSequence, CharSequence> replacers;
public Replacer() {
this.replacers = new HashMap<>();
@arantesxyz
arantesxyz / app.js
Created August 25, 2020 05:50 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@arantesxyz
arantesxyz / UsodaAPIdoSIU.md
Created August 26, 2020 22:42 — forked from brunoarmanelli/UsodaAPIdoSIU.md
Pesquisa e Documentação - SIU Mobile

Projeto ChatBUS - Uso da API do SIU Mobile

Muitas frustrações com o aplicativo oficial SIU Mobile me motivaram a escrever essa documentação. Toda a API foi especificada com o máximo de informações encontradas.

Nota do Autor

Este documento é totalmente privado e foi disponibilizado em link de Gist secreto para uso interno nas empresas que representam o SIU Mobile BH.

Todo o conteúdo foi observado através da transmissão de dados pela rede. Não foi utilizado nenhum código da aplicação.