Skip to content

Instantly share code, notes, and snippets.

View namse's full-sized avatar

Nam Se Hyun namse

View GitHub Profile
@namse
namse / redux-react-like.rs
Created March 27, 2023 09:00
redux-react-like rust rendering system
use std::sync::{Arc, Mutex};
fn main() {
println!("Hello, world!");
let app_state = TodoAppState {
text_input: text_input::State::new(),
todos: TodoState { todos: vec![] },
visibility_filter: VisibilityFilterState {
visibility_filter: VisibilityFilter::ShowAll,
},
@namse
namse / main.rs
Last active March 25, 2023 12:21
image hash and hamming distance for Visual Novel Standing CG Categorization
time cargo run > result6.txt
Finished dev [unoptimized + debuginfo] target(s) in 0.05s
Running `target/debug/img_hash`
real 0m0.580s
user 0m3.375s
sys 0m0.224s
(AMD Ryzen 5 2600 Six-Core Processor, 50 png images, each 700~1300 KB)
@namse
namse / index4.ts
Created September 4, 2021 18:34
namui rebuilding v0.4
import {
CanvasKit,
CanvasKitInit,
ClipOp,
Image,
InputRect,
InputRRect,
Paint,
Paragraph,
ParagraphStyle,
export {};
// 주제 : multiple counter
// update -> render -> event handling -> 반복
type State = {
counters: {
count: number;
}[];
};
@namse
namse / gist:4a02f541d3fae36f8ed0dd07d411bb25
Created May 29, 2020 13:40
3d video : Pixel with depth
The result of render is Pixel.
We can get z index(depth) of pixel too.
Save RGBA and Depth per frame -> 3D video.
3D Videos can be merged together using z index!
@namse
namse / v1.cpp
Last active May 31, 2019 17:14
#1058 가위 바위 보 하나 빼기 v1
#include <stdio.h>
#pragma warning (disable : 4996)
#define SCISSORS 1
#define ROCK 2
#define PAPER 3
#define WIN 1
#define LOSE -1
#define DRAW 0
@namse
namse / BaseNetworkConnector.cs
Created April 12, 2019 13:46
BaseNetworkConnector using System.IO.Pipelines
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.IO.Pipelines;
using System.Threading;
using System.Threading.Tasks;
using MessageSerializer;
namespace NetworkConnector.Connector
{
@namse
namse / NeedlemanWunschAlgorithm.js
Last active September 28, 2018 16:43
Needleman–Wunsch Algorithm
// code written by skatpgusskat 남세현
// https://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm
const dnaSequence1 = 'GCTAGGACTG'.split('');
const dnaSequence2 = 'ACGGATGCAT'.split('');
const LEFT = 'LEFT';
const TOP = 'TOP';
const TOP_LEFT = 'TOP_LEFT';
@namse
namse / qsort.js
Last active August 21, 2016 08:28
// from https://gist.github.com/zygygy/0feaff3f25ebe7e7e4dafa7b7f18c061
function partition(seq, pred) {
const first = [];
const second = [];
seq.forEach(i => {
if (pred(i)) {
first.push(i);
} else {
second.push(i);