This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ | |
# [0-9,a-z,A-Z] 62자로 구성되며 예측 난이도를 높이기 위해 무작위로 섞습니다. | |
BASE62 = "dCsuHTIWEcOPLhrgwBpRx4flv8JMKGDVmQ01qtejY9iNFzn5okX63aZAbySU27" | |
def encode(num, alphabet=BASE62): | |
if num == 0: | |
return alphabet[0] | |
arr = [] | |
base = len(alphabet) | |
while num: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def drawRatioBar(score_keytalk_category): | |
fig = plt.figure(figsize=(20,1)) | |
ax = fig.add_subplot(111) | |
patch_handles = [] | |
data = [r['score'] for r in score_keytalk_category] | |
percentages = [r['score'] for r in score_keytalk_category] | |
label = [r['kl_category'] for r in score_keytalk_category] | |
left = 0 | |
for d in data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rgb2hex(rgb): | |
''' | |
리스트 형식의 rgb 값을 hexcode로 변환 | |
:param rgb: list ex)[255, 255, 255] | |
:return : hex code | |
''' | |
return '#{:02x}{:02x}{:02x}'.format( rgb[0], rgb[1] , rgb[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hex2rgb(hexcode): | |
hexcode = hexcode.lstrip('#') | |
lv = len(hexcode) | |
return list(int(hexcode[i:i + lv // 3], 16) for i in range(0, lv, lv // 3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_area(degree): | |
area = 1 | |
if degree > 0 and degree <=90: | |
area = 1 | |
elif degree > 90 and degree <=180: | |
area = 2 | |
elif degree > 180 and degree <=270: | |
area = 3 | |
elif degree > 270 and degree <=360: | |
area = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# x= 2, y= 2 | |
# 1사분면 | |
np.arctan2(2, 2) * 180 / np.pi | |
# 45 | |
# x=-2, y= 2 | |
# 2사분면 | |
np.arctan2(2, -2) * 180 / np.pi | |
# 135 |