Skip to content

Instantly share code, notes, and snippets.

View 1eedaegon's full-sized avatar
Need more mocha =]

Gon ⌬ 1eedaegon

Need more mocha =]
  • Anywhere you want
  • 03:06 (UTC +09:00)
View GitHub Profile
@1eedaegon
1eedaegon / TimeDivisionFlowControl.js
Last active July 11, 2021 14:26
Concept: Dynamic time division flow control
// Typically, mordern client systems limit it 60 milliseconds
const FRAME_LIMIT = 100 // milliseconds, naaive
const TDFC = (MAXROW, cb) => {
return new Promise(resolve => {
const maxRow = MAXROW;
let cursor = 1; // start point
let partialMax = 10; // minimal loop block
let before = new Date().getTime();
let result;
@1eedaegon
1eedaegon / WorkerPromise.js
Last active July 14, 2023 00:31
Flow control(Multi threading): Web worker + Promise for Inversion of Control
// Warning!: It is not yet prevented for race condition!
const mine = { js: { type: 'application/javascript' } };
const WorkerPromise = f => {
let resolve;
let reject;
const worker = Object.assign(
new Worker(
URL.createObjectURL(
new Blob([`onmessage = e => postMessage((${f})(e.data));`], mine.js),
@1eedaegon
1eedaegon / readImageFromExcel.js
Last active May 3, 2024 02:51
Read image from excel file using ExcelJS
const ExcelJS = require('exceljs');
const workbook = new ExcelJS.Workbook();
const data = await workbook.xlsx.readFile('./test.xlsx');
const worksheet = workbook.worksheets[0];
for (const image of worksheet.getImages()) {
console.log('processing image row', image.range.tl.nativeRow, 'col', image.range.tl.nativeCol, 'imageId', image.imageId);
// fetch the media item with the data (it seems the imageId matches up with m.index?)
const img = workbook.model.media.find(m => m.index === image.imageId);
fs.writeFileSync(`${image.range.tl.nativeRow}.${image.range.tl.nativeCol}.${img.name}.${img.extension}`, img.buffer);
@1eedaegon
1eedaegon / VimSetUp.sh
Last active September 28, 2021 17:46
Vim setting
# 개발환경을 새로 잡을 일이 있어서 defualt setting을 기록
# Install bundle with pathogen for package manage
> mkdir -p ~/.vim/autoload ~/.vim/bundle && \
> curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
# Init pathogen
# No source, parsed from vim
> echo "execute pathogen#infect()" >> ~/.vimrc
# execute pathogen#infect()
@1eedaegon
1eedaegon / set-up-zsh.sh
Last active February 10, 2022 01:49
Setting zsh
# Memo for new_dev_env
# Install zsh to shell theme
# MAC(Catalina~) default shell is zsh already
# 1. Install zsh
> sudo apt install zsh
> brew install zsh(MAC)
# 2. Change bash to zsh
# and select option: 0
@1eedaegon
1eedaegon / set-local-github.sh
Last active October 5, 2021 17:48
git clone or git pull authentication failed
# How to set github on MacOS
# First if you use wsl2 ubuntu, try this: git.exe clone [remote-repo]
# Or git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-manager-core.exe"
# 1. Generate public key
$ ssh-keygen -t ed25519 -C "your_email@example.com"
# 2. Copy to clipboard public key
$ pbcopy ~/.ssh/id_ed25519.pub
# 2-1) if on Ubuntu
@1eedaegon
1eedaegon / diff.sh
Last active September 24, 2021 04:00
How to diffing between two entire or partial file/directory/proejct using git without winmerge
# Also you need to alias command or make shell script
# alias diff="git diff --no-index"
git diff --no-index some/path other/path >> some_filename
@1eedaegon
1eedaegon / recover.sh
Last active September 24, 2021 04:29
How to recover corrupted zsh_history
# 0. Move home directory
$ cd ~
# 1. Rename corrupted zsh_history
$ mv .zsh_history .zsh_history_bad
# 2. Encoding zsh_history_bad
$ strings -eS .zsh_history_bad > .zsh_history
# 3. Read history from file
$ fc -R .zsh_history
@1eedaegon
1eedaegon / update-visudo-editor-to-vim.sh
Last active October 19, 2021 05:45
How to change visudo nano editor to vim
#!/bin/bash
$ sudo update-alternatives --config editor
There are 4 choices for the alternative editor (providing /usr/bin/editor).
Selection Path Priority Status
------------------------------------------------------------
* 0 /bin/nano 40 auto mode
1 /bin/ed -100 manual mode
@1eedaegon
1eedaegon / use-driver-docker.sh
Created October 3, 2021 07:06
Can not find docker/docker.socket when minikube start --driver=none
#!/bin/bash
minikube start --driver=docker