Skip to content

Instantly share code, notes, and snippets.

View jiunbae's full-sized avatar
🏠
Working from home

Jiun Bae jiunbae

🏠
Working from home
View GitHub Profile
def truncate(string: str, max_length: int, suffix: str = "...", include_suffix_length: bool = True, mode: str = "center"):
"""Truncate string
:param string: input string
:param include_suffix_length: include suffix length to max_length
:param max_length: if string length is bigger than max_length, than truncate
:param suffix: trucate string, replace remain string to suffix
:param mode: select in ['left', 'center', 'right']
"""
if include_suffix_length:
손코딩은 나쁜게 아닙니다.

Keybase proof

I hereby claim:

  • I am jiunbae on github.
  • I am jiunbae (https://keybase.io/jiunbae) on keybase.
  • I have a public key whose fingerprint is 5588 48C3 6FB8 B5B9 CB85 17C8 260E B1CC 493F 6221

To claim this, I am signing this object:

@jiunbae
jiunbae / 띠용 코드 챌린지
Last active December 2, 2021 23:09
제1회 프로그래머스 배 띠용 코드 챌린지 ~ 한 줄로 짤 코드를 누가 436 줄로 만들어놨어요? ~
## Author: Jiun Bae (2019/08/18)
## ## See also (https://github.com/jiunbae/ITE4053/tree/master/NumpyNeuralNetwork)
from typing import Optional, List, Union, Tuple, Iterable, Callable
from functools import reduce
import numpy as np
## Class Definition
# _Module
@jiunbae
jiunbae / list.h
Created December 3, 2017 09:24
Lock Free Linked List
/*****************************************************************************
MIT License
Copyright (c) 2017 Bae jiun, Maybe
@see also https://choosealicense.com/licenses/mit/
*****************************************************************************/
@jiunbae
jiunbae / thread.Pool.java
Last active November 28, 2017 09:16
Simple thread pool
package concurrent;
import java.util.Arrays;
import java.util.concurrent.LinkedBlockingQueue;
public class Pool {
private boolean terminate;
private final Worker[] workers;
private final LinkedBlockingQueue<Runnable> queue;
@jiunbae
jiunbae / plot drawer
Last active October 27, 2017 14:28
plot drawer for Project3@ITE4065
#!/bin/python
'''
File name: draw.py
Author: Bae Jiun, Maybe
Date created: 10/27/2017
Requirements:
- matplotlib
'''
from subprocess import Popen, PIPE
@jiunbae
jiunbae / Thread.h
Created September 26, 2017 17:48
Thread::Pool support C++11 standard
#ifndef THREAD_POOL_H
#define THREAD_POOL_H
#include <vector>
#include <queue>
#include <memory>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <future>
#include <functional>
@jiunbae
jiunbae / bogo_genetic.py
Created July 19, 2017 09:20
Optimizing bogosort genetic algorithm
from random import sample, uniform, randrange, shuffle
from time import sleep
def breed(mother, father):
fetus = mother[:randrange(len(mother))]
sperm = list(filter(lambda x: x not in fetus, father))
return fetus + sperm
def fitness(array):
return len(list(filter(lambda x: x[0]==x[1],
ta_debug.exe
115200 bytes
0 ms program start!
0 ms process start!
1054 ms vector generated! 1000000
1318 ms vector swaped!! 100000
3543 ms vector sorted!
3544 ms program done!
ta_debug_64.exe
157696 bytes