Skip to content

Instantly share code, notes, and snippets.

View ychoi-kr's full-sized avatar
😀

Yong Choi ychoi-kr

😀
View GitHub Profile
@ychoi-kr
ychoi-kr / clock.c
Last active May 19, 2021 04:21
time conversion for digital clock
#include <stdio.h>
#include <stdbool.h>
int main() {
//bool hours12 = false;
bool hours12 = true;
int hour, minute;
scanf("%d%d", &hour, &minute);
int currentTime = hour * 100 + minute;
@ychoi-kr
ychoi-kr / gist:cf61a7da0ae064439f5fa9bbb00773ce
Last active May 19, 2021 04:10
simple type inference with try-except in python
>>> def triple_input_number():
... x = input()
... try:
... n = int(x)
... return n * 3
... except:
... pass
...
>>> triple_input_number()
3
>>> for n in range(3, 20, 3):
... print(f'{n:2d}')
...
3
6
9
12
15
18
@ychoi-kr
ychoi-kr / ex03-1_create_pets_table.sql
Last active October 11, 2023 01:08
SQLite로 가볍게 배우는 데이터베이스 - 연습 문제 해답
create table "pets" (
"ID" integer not null,
"Name" text not null,
"Animal" text,
primary key("ID")
);
@ychoi-kr
ychoi-kr / p43-1.txt
Created June 1, 2021 08:47
강화학습/심층강화학습 특강 편집
# 최고라고 생각하는 슬롯머신 표시하기
nSelected = nPosReward + nNegReward
for i in range(d):
print('Machine number ' + str(i+1) + ' was selected ' + str(nSelected[i]) + ' times')
print('Conclusion: Best machine is machine number ' + str(np.argmax(nSelected) + 1))
@ychoi-kr
ychoi-kr / book_cover_3d.png
Last active July 7, 2021 07:23
생활코딩 이론편 소개 글
book_cover_3d.png
@ychoi-kr
ychoi-kr / install_konlpy.py
Created November 26, 2021 10:24
KoNLPy 최신 버전 설치
import os
from urllib.parse import urlparse
import urllib.request
import zipfile
import tempfile
from subprocess import call
zip_url = 'https://github.com/konlpy/konlpy/archive/refs/heads/master.zip'
dirname = 'konlpy-master'
# https://www.facebook.com/groups/pythonkorea/permalink/4703346156415175/
s = 'program'
L = list(s)
for _ in s:
L = [L.pop(-1)] + L
print(''.join(L))
@ychoi-kr
ychoi-kr / choose_license_ko.dot
Last active November 26, 2022 12:42
라이선스 선택 결정 트리(https://wikidocs.net/180842)
digraph {
love_something [label="공유하고 싶은\n것이 있나요?" style="filled" fillcolor="orange"]
did_you_make_it [label="직접\n만들었나요?" shape=diamond style="filled" fillcolor="yellow"]
is_it_in_the_public_domain [label="퍼블릭 도메인에\n속해 있나요?" shape=diamond style="filled" fillcolor="yellow"]
public_domain [label="이 작품은 퍼블릭\n도메인에 있습니다.\n자유롭게 공유하세요." shape=rect style="rounded,filled" fillcolor="green" fontcolor="white" URL="https://ko.wikipedia.org/wiki/퍼블릭_도메인"]
did_you_improve_or_modify [label="당신이 창조적인\n방식으로 개선하거나\n수정했나요?" shape=diamond style="filled" fillcolor="yellow"]
is_it_shared_with_an_open_content_license [label="공개 콘텐트\n라이선스로\n공유되나요?" shape=diamond style="filled" fillcolor="yellow"]
share_freely_under_the_license_terms [label="라이선스 조건에\n따라 자유롭게\n공유" style="filled" fillcolor="pink"]
you_hold_a_copyright [label="당신이 작품에 대한\n저작권을 보유합니다.\n타인의 채택, 변경,\n재배포를 금지합니다." shape=rect style="rounded,filled" fillcolor="red"]
pirate [label="저작권은 귀하의 공정 사용\n권리를 침해하지 않습니다.\n그러나 해적으로 기소될 수\n있습니다." shap
@ychoi-kr
ychoi-kr / srt.py
Created November 5, 2023 09:37
whisper scripts
# modified script from https://github.com/openai/whisper/discussions/98#discussioncomment-3725983
from datetime import timedelta
import os
import sys
import whisper
def transcribe_audio(path):
model = whisper.load_model("large")
print("Whisper model loaded.")