Skip to content

Instantly share code, notes, and snippets.

View WKBae's full-sized avatar

Kyungmin Bae WKBae

  • Devsisters Corp.
  • Seoul, South Korea
View GitHub Profile
@WKBae
WKBae / semaphore.js
Created July 19, 2024 12:31
JS Async Semaphore / Limit Concurrency
function semaphore(n) {
let running = 0;
const queue = [];
return (fn) => {
return new Promise((resolve) => {
const task = () => {
running++;
resolve(
fn().finally(() => {
running--;
🌞 Morning 278 commits ████░░░░░░░░░░░░░░░░░ 19.1%
🌆 Daytime 720 commits ██████████▍░░░░░░░░░░ 49.6%
🌃 Evening 443 commits ██████▍░░░░░░░░░░░░░░ 30.5%
🌙 Night 12 commits ▏░░░░░░░░░░░░░░░░░░░░ 0.8%
@WKBae
WKBae / unlimited_buffered_chanel.go
Created March 29, 2020 12:37
Unlimited buffered channel in Go
package main
import (
"fmt"
"sync"
"time"
)
func unlimitedBufferer(in <-chan int, out chan<- int) {
var buffer []int

Keybase proof

I hereby claim:

  • I am wkbae on github.
  • I am wkbae (https://keybase.io/wkbae) on keybase.
  • I have a public key ASCqx7Fvx6LeDfoLSjG5UrFMXKLcaANzfm9032L2viJslgo

To claim this, I am signing this object:

@WKBae
WKBae / mnist-tester.html
Last active November 9, 2017 13:19
MNIST tester using Flask
<html>
<head><title>MNIST Tester</title></head>
<style>
#number-pad {
padding: 0;
margin: 0;
border-collapse: collapse;
border: 1px solid #000;
}
#number-pad tr {
@WKBae
WKBae / zip-password-finder.py
Last active September 21, 2017 08:54
Quick brute-force password finder of an encrypted zip file.
"""
Quick brute-force password finder of an encrypted zip file.
"Life's short, use Python."
by WKBae (https://github.com/WKBae/)
"""
import zipfile
from multiprocessing import Pool
@WKBae
WKBae / joiner.py
Created July 17, 2017 02:00
.srt Subtitle Joiner
import re
duration_re = re.compile(r"^\d{2}:\d{2}:\d{2},\d{3} --> \d{2}:\d{2}:\d{2},\d{3}\n$")
with open('input1.srt', 'r', encoding='utf-8') as one, open('input2.srt', 'r', encoding='utf-8') as two, open('result.srt', 'w', encoding='utf-8') as out:
one_lines = []
line = one.readline()
while line:
while len(line) == 1:
line = one.readline()