Skip to content

Instantly share code, notes, and snippets.

View osdeving's full-sized avatar

Willams S. de Sousa osdeving

  • Santa Bárbara D'Oeste - SP
View GitHub Profile
@osdeving
osdeving / HeapSort.java
Created September 13, 2022 02:50
Exemplo HeapSort feito em Java
public class HeapSort {
public static void main(String[] args) {
int[] v = new int[] {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
int n = v.length;
for(int i = n / 2 - 1; i >= 0; i--)
heapify(v, n, i);
for(int j = n - 1; j > 0; j--) {
@osdeving
osdeving / deploy-tomcat-manualmente.md
Last active September 8, 2022 05:31
Deploy no tomcat 9 manualmente

Crie as pastas

  • Crie uma pasta chamada hello

  • Crie uma pasta chamada WEB-INF dentro de hello

  • Crie uma pasta chamada classes dentro de WEB-INF

  • Crie uma pasta chamada hello dentro de classes

package br.com.willams.datastructures.impl;
import java.util.Comparator;
import java.util.function.Consumer;
import br.com.willams.datastructures.BinarySearchTree;
import br.com.willams.datastructures.TraversalType;
@Component
@Slf4j
public class ConsumerListener {
private final BiometryConsumerProcessor consumerProcessor;
private final ApplicationConfig appConfig;
private Executor executor;
public ConsumerListener(BiometryConsumerProcessor consumerProcessor, ApplicationConfig appConfig) {
this.consumerProcessor = consumerProcessor;
@osdeving
osdeving / AsyncWithFuture.java
Created May 23, 2022 12:45
Assyn in Java using Future
package com.willams;
import java.util.concurrent.*;
public class AsyncWithFuture {
public static void main(String[] args) {
ExecutorService executorService = Executors.newCachedThreadPool();
Future<Double> future = executorService.submit(new Callable<Double>() {
public Double call() {
@osdeving
osdeving / ConsolePrinter.java
Last active November 23, 2021 02:39
classe para imprimir texto colorido no console em java
public class ConsolePrinter {
public enum Color {
BLACK, RED, GREEN, YELLOW, BLUE, PURPLE, CYAN, WHITE,
}
public enum Style {
NORMAL, BOLD, DUMMY1, DUMMY2, UNDERLINE
}
private static final String ESCAPE_CODE = "\033[";
// essa aplicação demonstra o uso do Spring Web MVC com o paradigma funcional e sem o paradigma funcional (usando anotações)
// As classes estão no mesmo arquivo por brevidade,
// mas estariam em seus respectivos pacotes numa aplicação real (model, service, controller)
@SpringBootApplication
public class ExcecuteApplication {
public static void main(String[] args) {
SpringApplication.run(ExcecuteApplication.class, args);
}
// esse bean equivale a um PersonController
#include <stdio.h>
#include <string.h>
#include <math.h>
#define BASE 8
int main()
{
// coloca de forma manual o valor "1234"
char minha_string[5];
#pragma once
namespace ventania
{
namespace math3d
{
template<class T>
class vector3
{
public:
#pragma once
namespace ventania
{
struct Window
{
HWND handle = 0;
WNDCLASS wc;
};