Skip to content

Instantly share code, notes, and snippets.

View mjy9088's full-sized avatar

Juyeong Maing mjy9088

  • 대한민국
  • 03:10 (UTC +09:00)
View GitHub Profile
@mjy9088
mjy9088 / criticalSection.ts
Last active January 24, 2024 09:46
Typescript CriticalSection
interface Pending {
resolve: (value: any) => void;
reject: (error: any) => void;
criticalSection: () => Promise<unknown>;
}
export function criticalSection(): <T>(
criticalSection: () => Promise<T>
) => Promise<T> {
const pending: Pending[] = [];
@mjy9088
mjy9088 / get_next_line.c
Last active September 19, 2023 18:01
get_next_line in 4 functions
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: Juyeong Maing <jmaing@student.42seoul.kr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/16 16:47:34 by Juyeong Maing #+# #+# */
/* Updated: 2023/04/22 19:26:51 by Juyeong Maing ### ########.fr */
/* */
@mjy9088
mjy9088 / README.md
Last active February 26, 2023 15:37
Setup raspberry pi home k3s cluster

Setup raspberry pi home k3s cluster

[TOC]

Installation

  1. Download Raspberry Pi Imager on laptop
  2. Setup network anyway...
  3. Setup each cluster nodes (raspberry pis)
  4. Write to Micro SD or USB drive using Raspberry Pi Imager, with SSH enabled
@mjy9088
mjy9088 / Makefile
Created March 31, 2022 17:18
config.mk generator
Q := $(if $(filter 1,$(V) $(VERBOSE)),,@)
NAME := config.mk
$(NAME): variable_cc.mk variable_diagnostics.mk
$Qrm -f tmp_$@
$Qcat variable_*.mk > tmp_$@
$Qmv tmp_$@ $@
$Qecho "Configure OK!"
$Qmake --no-print-directory clean
@mjy9088
mjy9088 / init.sh
Last active February 26, 2023 15:40
Development environment setup script for 42schools
#!/bin/bash
# link cache directories to goinfre
TARGET=(
"Caches"
"ApplicationSupport/Code/Cache"
"ApplicationSupport/Code/CachedData"
"ApplicationSupport/Code/CachedExtensions"
@mjy9088
mjy9088 / Dockerfile
Last active March 4, 2022 01:34
Janus test dockerfile - currently WIP
FROM ubuntu:18.04
# command: docker build -t janus-test:0.0.2 .
# install dependencies
RUN apt update && apt install -y \
libjansson-dev \
libconfig-dev \
libnice-dev \
@mjy9088
mjy9088 / main.sh
Created February 10, 2022 01:49
To test dts react...
git clone --sparse --filter=blob:none --depth=1 -b $BRANCH_NAME --single-branch $REPOSITORY_URL dts-react
cd dts-react
npm i
npm i csstype
git sparse-checkout add prop-types
git sparse-checkout add scheduler/tracing
git sparse-checkout add react-dom
git sparse-checkout add types/react-addons-create-fragment
git sparse-checkout add types/react-addons-linked-state-mixin
git sparse-checkout add types/react-addons-pure-render-mixin
@mjy9088
mjy9088 / input-autocomplete.js
Last active December 30, 2021 06:48
Input autocompletion
var InputAutocomplete = window.InputAutocomplete = (function () {
function result(options) {
if (!(this instanceof result)) throw new Error('InputAutocomplete is a constructor');
if (!options) throw new Error('InputAutocomplete requires options to be provided');
this.inputElement = options.inputElement;
this.show = options.show;
this.hide = options.hide;
this.setFailed = options.failed;
this.setLoading = options.loading;
this.setPlaceholder = options.placeholder;
@mjy9088
mjy9088 / infinite-scroll.js
Last active December 30, 2021 01:31
remove invisible elements from DOM tree
var InfiniteScroll = window.InfiniteScroll = (function () {
var instanceKey = window.Symbol ? Symbol('InfiniteScroll') : '__IE_POLYFILL__SYMBOL__INFINITE_SCROLL';
function result(options) {
if (!(this instanceof result)) {
throw new Error('InfiniteScroll must called with new operator and options object');
}
this.init(options);
}
Object.defineProperties(result.prototype, {
init: {
@mjy9088
mjy9088 / main.cpp
Last active May 22, 2021 10:13
Direct3D Tutorial
//-----------------------------------------------------------------------------
// File: Meshes.cpp
//
// Desc: For advanced geometry, most apps will prefer to load pre-authored
// meshes from a file. Fortunately, when using meshes, D3DX does most of
// the work for this, parsing a geometry file and creating vertx buffers
// (and index buffers) for us. This tutorial shows how to use a D3DXMESH
// object, including loading it from a file and rendering it. One thing
// D3DX does not handle for us is the materials and textures for a mesh,
// so note that we have to handle those manually.