Skip to content

Instantly share code, notes, and snippets.

@matheusmv
matheusmv / objects.w
Last active November 28, 2023 20:58
wesly examples
object User {
id int
username string
password string
address object {
zip, street string
number int
}
}
@matheusmv
matheusmv / memo.js
Last active July 7, 2023 03:00
simple memoization
const put = (cache, params, result) => {
let node = cache;
for (const param of params) {
const key = param.toString();
if (!node[key]) {
node[key] = {};
}
// g++ bezier-casteljau-opengl.cpp -lSDL2 -lGL -lglut
#include <iostream>
#include <sstream>
#include <vector>
#include <SDL2/SDL.h>
#include <GL/gl.h>
#include <GL/glut.h>
struct Vec2 {
// gcc -Wall -Werror -Wextra -std=c11 orbiting-spheres-gl.c -lSDL2 -lGL -lglut -lm
#include <math.h>
#include <stdbool.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <GL/gl.h>
#include <GL/glut.h>
const int WINDOW_WIDTH = 800;
@matheusmv
matheusmv / lstm.py
Created May 21, 2023 18:46
LSTM study
from math import exp, tanh
from typing import List, Tuple
Matrix = List[List[float]]
def build_matrix(number_of_rows: int, number_of_columns: int) -> Matrix:
return [[0.0] * number_of_columns for _ in range(number_of_rows)]
@matheusmv
matheusmv / index.html
Last active March 18, 2023 14:49
exemplo interpolação linear com cores
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Color Transition</title>
<style>
* {
margin: 0;
@matheusmv
matheusmv / method-decorator.ts
Last active April 27, 2023 15:50
dummy decorator method for cache
class User {
createdAt: Date = new Date();
constructor(
public id: number,
public username: string,
public password: string,
public email: string
) { }
}
@matheusmv
matheusmv / queue.c
Last active January 15, 2023 12:37
queue with dynamic array in c
#include "queue.h"
#include <assert.h>
static Queue* queue_malloc(size_t capacity, object_copy copy_func, object_free free_func) {
Queue* queue = NULL;
Vector* array = NULL;
queue = calloc(1, sizeof(Queue));
if (queue == NULL)
@matheusmv
matheusmv / ConsoleLoadBar.java
Last active December 31, 2022 03:44
dummy progress bar in java
import java.io.IOException;
import java.time.Duration;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
public class ConsoleLoadBar {
private static final Logger LOGGER = Logger.getLogger(ConsoleLoadBar.class.getSimpleName());
@matheusmv
matheusmv / Dockerfile
Last active September 28, 2022 18:41
java spring app dockerfile example
FROM amazoncorretto:17-alpine-jdk AS jdk-builder
WORKDIR /app
COPY . ./
#gradle
#RUN ./gradlew build
#maven