Skip to content

Instantly share code, notes, and snippets.

@yeonwooz
yeonwooz / vite.config.ts
Created April 8, 2024 06:31
vite config with proxy
import { defineConfig, loadEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
// https://vitejs.dev/config/
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return defineConfig({
plugins: [vue()],
@yeonwooz
yeonwooz / api-generator.ts
Last active December 14, 2023 15:19
api generator
// api generator using swagger-typescript-api
import { exec } from 'shelljs';
const swaggerPath = `${__dirname}/../packages/api/swagger.json`;
const targetPath = `${__dirname}/../packages/front/src/api`;
async function generateApi() {
exec(`npx swagger-typescript-api \
-p ${swaggerPath} \ // json 또는 yaml 파일
-o ${targetPath} \ // api 파일을 만들 목적지 디렉토리
@yeonwooz
yeonwooz / Canvas_API_Wind.js
Created October 5, 2023 01:19
Canvas API Wind
// App.js
import {randomNumBetween} from "../../utils.js";
import Leaf from "./Leaf.js";
import Mouse from "./Mouse.js";
import Rain from "./Rain.js";
export default class App {
static canvas = document.querySelector("canvas");
static ctx = App.canvas.getContext("2d");
static dpr = devicePixelRatio > 1 ? 2 : 1;
@yeonwooz
yeonwooz / Canvas_API_Leaf.js
Created October 5, 2023 01:17
Canvas API Leaf
// App.js
import {randomNumBetween} from "../../utils.js";
import Leaf from "./Leaf.js";
export default class App {
static canvas = document.querySelector("canvas");
static ctx = App.canvas.getContext("2d");
static dpr = devicePixelRatio > 1 ? 2 : 1;
static interval = 1000 / 60;
static width = 1024;
@yeonwooz
yeonwooz / Canvas_API_Rain.js
Last active October 5, 2023 01:20
Canvas API Rain
// App.js
import {randomNumBetween} from "../../utils.js";
import Rain from "./Rain.js";
export default class App {
static canvas = document.querySelector("canvas");
static ctx = App.canvas.getContext("2d");
static dpr = devicePixelRatio > 1 ? 2 : 1;
static interval = 1000 / 60;
static width = 1024;
@yeonwooz
yeonwooz / Canvas_API_backgorund.js
Last active October 5, 2023 01:15
Canvas API backgorund
// App.js
import {randomNumBetween} from "../../utils.js";
import Background from "./Background.js";
export default class App {
static canvas = document.querySelector("canvas");
static ctx = App.canvas.getContext("2d");
static dpr = devicePixelRatio > 1 ? 2 : 1;
static interval = 1000 / 60;
@yeonwooz
yeonwooz / Web Component Example.html
Last active August 28, 2023 14:37
Web Component Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web Component Example</title>
</head>
<body>
<!-- 웹 컴포넌트 사용 예시 -->
<my-web-component>
@yeonwooz
yeonwooz / WIN10.MD
Created June 9, 2023 14:21 — forked from hungneox/WIN10.MD
How Make a Windows 10 USB Using Your Mac - Build a Bootable ISO From Your Mac's Terminal

Most new PCs don't come with DVD drives anymore. So it can be a pain to install Windows on a new computer.

Luckily, Microsoft makes a tool that you can use to install Windows from a USB storage drive (or "thumbdrive" as they are often called).

But what if you don't have a second PC for setting up that USB storage drive in the first place?

In this tutorial we'll show you how you can set this up from a Mac.

Step 1: Download the Windows 10 ISO file

You can download the ISO file straight from Windows. That's right - everything we're going to do here is 100% legal and sanctioned by Microsoft.

@yeonwooz
yeonwooz / nginx_reverse_proxy_socket_io.sh
Created February 9, 2023 06:37
nginx reverse proxy configuration for socket i.o
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
proxy_pass http://127.0.0.1:8080/;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade; // 핸드셰이크 업그레이드
proxy_set_header Connection "upgrade";
@yeonwooz
yeonwooz / SWAP.c
Last active December 14, 2022 17:28
swap
struct frame *vm_evict_frame () {
struct frame *victim = vm_get_victim ();
swap_out (victim->page); // 페이지 스왑 아웃
return victim;
}
struct frame *vm_get_frame () {
...
return vm_evict_frame();