Skip to content

Instantly share code, notes, and snippets.

@celsowm
celsowm / main.c
Created November 24, 2024 22:46
drawLine in SGDK
#include <genesis.h>
// Função genérica para desenhar uma linha entre dois pontos
void drawLine(u16 x0, u16 y0, u16 x1, u16 y1, u16 paletteIndex, u16 color, u8 tileSize)
{
// Cria dinamicamente um tile com base no tamanho configurável
u32 lineTile[64]; // Máximo de 64 linhas (8x8 pixels no máximo)
for (int i = 0; i < tileSize; i++)
{
// Cada linha do tile terá todos os bits preenchidos com '1' (para linhas sólidas)
@VvanGemert
VvanGemert / flux_on_potato.py
Last active August 20, 2024 06:29 — forked from AmericanPresidentJimmyCarter/flux_on_potato.py
how to run flux on your 16gb potato
# First, in your terminal.
#
# $ python3 -m virtualenv env
# $ source env/bin/activate
# $ pip install torch torchvision transformers sentencepiece protobuf accelerate
# $ pip install git+https://github.com/huggingface/diffusers.git
# $ pip install optimum-quanto
# $ pip install gradio
import torch
<?php
declare(strict_types=1);
class Loop
{
private static ?Loop $loop = null;
private array $queue = [];
@m6w6
m6w6 / Fibers.md
Last active October 5, 2022 21:56
Fibers are...

Fibers are...

  +------------------------------------------------------------+
  | Process                                                    |
  |   +--------------------------------------------------------+
  |   | Threads (OS/User)                                      |
  |   |   +----------------------------------------------------+
  |   |   | Coroutines                                         |
  |   |   |   + -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - +
 | | | | ┌ Fiber (with stack, yield anywhere) |
@Shelob9
Shelob9 / encrypted-hi-roy.php
Last active July 8, 2020 15:02
Basic Hi Roy example of PHP encryption/decryption. #ApexSecurity
<?php
$key = random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES);
$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
$ciphertext = sodium_crypto_secretbox("Hi Roy", $nonce, $key);
$plaintext = sodium_crypto_secretbox_open($ciphertext, $nonce, $key);
if ($plaintext === false) {
throw new Exception("Bad ciphertext");
@rakeshtembhurne
rakeshtembhurne / render_view_as_variable.php
Created July 19, 2013 10:10
CakePHP: Render view in a variable inside controlller
<?php
$view = new View($this, false);
$view->set(compact('some', 'vars'));
$html = $view->render('view_name');