Skip to content

Instantly share code, notes, and snippets.

View LucasAlfare's full-sized avatar
💭
Attempting "masterize" JetPack Compose

Francisco Lucas LucasAlfare

💭
Attempting "masterize" JetPack Compose
View GitHub Profile
@LucasAlfare
LucasAlfare / nick_blundel_pt_br.txt
Created January 17, 2024 03:54
tradução crua de "how to make an operating system from scratch", de nick blundell, para português
Esta narração é gerada automaticamente com base em traduções também automáticas do excelente material escrito por Nick Blundell. Dessa forma, é importante que vocês ouvintes entendam que muitas palavras que serão narradas aqui poderão não ter entonação ou serem pronunciadas de forma estranha. Além disso, por se tratar de um conteúdo relacionado a códigos, a narração pode não conseguir balbuciar esses trechos de uma forma tão compreensível.
Baseado nessa conclusão, a ideia deste áudio-livro é servir como auxílio para aqueles que têm dificuldade de leitura. Além disso, encorajamos o máximo possível que o acompanhamento dessa narração seja feita em simultâneo com o material original, o que será algo que dará uma compreensão muito melhor para vocês.
Por fim, o material original conta com vários exemplos, snippets de código e até mesmo imagens, então é imprecindível que esse livro seja utilizado, também, como guia prático para o tema que ele propõe, o desenvolvimento de um sistema operacional simples.
Vale lembrar
@LucasAlfare
LucasAlfare / ProceduralMapGenerationWithPerlinNoise.java
Created September 23, 2023 20:14 — forked from smonteillet/ProceduralMapGenerationWithPerlinNoise.java
Simple Procedural Map Generation using Java/Swing and a Perlin Noise like algorithm
import java.awt.Color;
import java.awt.Graphics;
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JPanel;
public final class ProceduralMapGenerationWithPerlinNoise
{
package org.rogach.jopenvoronoi;
import java.io.*;
import java.util.*;
import java.awt.geom.Point2D;
import java.awt.Color;
// random polygon generator
// uses space partitioning algorithm, described here: http://www.geometrylab.de/applet-29-en#space
public class RandomPolygon {
@LucasAlfare
LucasAlfare / Coordinate.js
Last active May 29, 2023 19:42
Draft of pathfinding, in Javascript.
/**
* Class used to represent a single coordinate of a two-dimensional space.
*
* Also, this coord should be used in context where the actual coordinate system
* lies in the 4-th quadrant.
*/
class Coordinate {
/**
* Creates a new coordinate object with x and y coordinates based on params.
* @param {number} x the x coordinate to this object.
@LucasAlfare
LucasAlfare / Main.kt
Created May 25, 2023 23:01
My own implementation to the A* pathfinding algorithm, written in Kotlin.
import kotlin.math.abs
const val width = 59
const val height = 80
fun main() {
val start = Coord(0, 3)
val end = Coord(3, 4)
val obstacles = listOf(
@LucasAlfare
LucasAlfare / gearcube.js
Created May 24, 2023 20:56 — forked from cs0x7f/gearcube.js
Gear Cube Random State Scramble
var getgearoptscramble=(function() {
var cmv = [];
var emv = [];
var prun = [];
function cornerMove(idx, m) {
var arr = [], temp;
mathlib.setNPerm(arr, idx, 4);
temp = arr[0];
arr[0] = arr[m+1];
@LucasAlfare
LucasAlfare / index.html
Created January 5, 2023 16:16
Esse código mostra na janela do navegador o dia de hoje.
<!DOCTYPE html>
<html lang="en">
<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>Que dia é hoje?</title>
<h1 id="target">Calculando o dia de hoje...</h1>
@LucasAlfare
LucasAlfare / Main.kt
Created December 28, 2022 17:14
draft puzzle state with hexadecimals
import java.math.BigInteger
import kotlin.math.max
import kotlin.math.min
fun Long.toHexString(): String = BigInteger(this.toString()).toString(16)
class Hexrray(var n: Long) {
operator fun get(i: Int) =
(n shr (48 - ((min(48, i + 1)) * 4))) and 0xf
@LucasAlfare
LucasAlfare / Main.kt
Last active November 25, 2022 15:45
rasc multiple coroutines
import kotlinx.coroutines.*
abstract class Manageable {
private val listeners = mutableListOf<Manageable>()
var initiated = false
abstract suspend fun init()
abstract fun onEvent(e: String, data: Any? = null)
@LucasAlfare
LucasAlfare / main.kt
Last active September 6, 2022 19:28
Helper that I created in order to extract better information from MIDI files about notes, chords and rests (and their durations). I should include timming convertions in the future, btw feel free to help improve.
/**
* @author Francisco Lucas (a.k.a. LucasAlfare); 06/09/2022.
*/
import java.io.File
import javax.sound.midi.MidiSystem
import javax.sound.midi.ShortMessage
fun main() {
processedNotesFrom("test.mid")
.forEach {