Skip to content

Instantly share code, notes, and snippets.

View wwylele's full-sized avatar
🐟
Eating fish

Weiyi Wang wwylele

🐟
Eating fish
View GitHub Profile
@wwylele
wwylele / elliptic-curve-11.a2-j-param.txt
Last active September 7, 2024 00:07
Elliptic curve 11.a2 j-parametrization
y^2+y=x^3-x^2-10x-20
N = 11
*** X ***
x(j, jN) = sum{m,n}(`Nume_j{m}_jN{n}` * j^m * jN^n) / sum{m,n}(`Deno_j{m}_jN{n}` * j^m * jN^n)
Nume_j0_jN0 = 1367113046330556187051562246931529529235173270511187871278506926568049114456858932866795018649600000000000000000000000000000000
Nume_j0_jN1 = 172077374923733266210058979716334157205392753267437347302297658019755587516877358694295477944320000000000000000000000000000
Nume_j0_jN2 = -552789772512187113151284771321330488507779196392441002872875423014679654464608838881247441715200000000000000000000000000
Nume_j0_jN3 = 115306161437651131485119279159886334295579735205039155402832479989832602929746998006911074304000000000000000000000000
@wwylele
wwylele / dijkstra.rs
Last active July 24, 2020 04:02
dijkstra template in rust
use std::ops::{Index, IndexMut, Add};
use std::cmp::Ord;
#[derive(Clone, Copy)]
pub enum NodeStatus {
Unknown,
Visiting(usize),
Visited,
}
@wwylele
wwylele / main.rs
Created June 14, 2020 04:46
Rust template template parameter
use std::collections::*;
use std::hash::Hash;
use std::iter::FromIterator;
trait SetFunc<T> {
type Set: IntoIterator + FromIterator<T>;
}
struct BTreeSetF;
@wwylele
wwylele / doc.md
Created July 26, 2018 16:13
WIP 3DS CEC doc

3DS CEC (StreetPass) Documentation

Overall Model

The CEC system module consists of two main components: mailbox manager and StreetPass communicator. Both work on the system save 00010026, which stores all mailbox information and message data. A simplified diagram of CEC communication model is

Application <=> Mailbox Manager <=> System Save (Mailbox) <=> StreetPass communicator <=> NWM/network <=> StreetPass communicator of another 3DS <=> ...

Many CEC service (cecd:u and cecd:s) functions are interfaces exposed from the mailbox manager, which read and write the system save. The mailbox manager is essentially a thick layer over direct file IO, which performances data initialization and verification on top of raw system data read/write.

@wwylele
wwylele / main.c
Created July 5, 2018 07:43
proctex mipmap test
#include <3ds.h>
#include <citro3d.h>
#include <tex3ds.h>
#include <string.h>
#include <stdlib.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
@wwylele
wwylele / main.c
Created July 2, 2018 18:13
mipmap test
#include <3ds.h>
#include <citro3d.h>
#include <tex3ds.h>
#include <string.h>
#include <stdlib.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
@wwylele
wwylele / main.c
Created May 5, 2018 01:29
primitive restart test
#include <3ds.h>
#include <citro3d.h>
#include <string.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
(GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
GX_TRANSFER_IN_FORMAT(GX_TRANSFER_FMT_RGBA8) | GX_TRANSFER_OUT_FORMAT(GX_TRANSFER_FMT_RGB8) | \
@wwylele
wwylele / sample shader
Created April 24, 2018 08:44
sample shader
////////////////////////////////////////////////////////////////
/// Programmable Vertex Shader
#version 330 core
#extension GL_ARB_separate_shader_objects : enable // only presents for separable shader
struct pica_uniforms {
bool b[16];
uvec4 i[4];
vec4 f[96];
#include <3ds.h>
#include <stdio.h>
#include <citro3d.h>
#include <string.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
(GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \
@wwylele
wwylele / main.c
Created March 13, 2018 11:15
shadow map sampling
#include <3ds.h>
#include <stdio.h>
#include <citro3d.h>
#include <string.h>
#include "vshader_shbin.h"
#define CLEAR_COLOR 0x68B0D8FF
#define DISPLAY_TRANSFER_FLAGS \
(GX_TRANSFER_FLIP_VERT(0) | GX_TRANSFER_OUT_TILED(0) | GX_TRANSFER_RAW_COPY(0) | \