Skip to content

Instantly share code, notes, and snippets.

View junhoyeo's full-sized avatar
๐Ÿดโ€โ˜ ๏ธ

Junho Yeo junhoyeo

๐Ÿดโ€โ˜ ๏ธ
View GitHub Profile
@junhoyeo
junhoyeo / 10xyz.py
Last active December 12, 2018 13:19
์„ธ ์‹ค์ˆ˜ x, y, z๊ฐ€ ๋‹ค์Œ ์กฐ๊ฑด์„ ๋งŒ์กฑ์‹œํ‚จ๋‹ค. 1) x, y, 2z ์ค‘์—์„œ ์ ์–ด๋„ ํ•˜๋‚˜๋Š” 3์ด๋‹ค. 2) 3(x+y+2z)=xy+2yz+2zx ์ด๋•Œ 10xyz์˜ ๊ฐ’์„ ๊ตฌํ•˜์‹œ์˜ค
import numpy as np
def check(x, y, z, log=False):
s1 = True if any(i==3 for i in [x, y, z*2]) else False
s2 = 3*(x+y+2*z)==x*y+2*y*z+2*z*x
if log: print(3*(x+y+2*z), '==', x*y+2*y*z+2*z*x)
return s1 and s2
for i in np.arange(0, 100, 0.5):
for j in np.arange(0, 100, 0.5):
@junhoyeo
junhoyeo / Standard-Inssa-Syntax.md
Last active June 21, 2023 14:44
๋„์›€: ๋””๋ฏธ๊ณ  18๊ธฐ ์‹ ์ž…์ƒ ํ†ก๋ฐฉ
@junhoyeo
junhoyeo / pic.png
Last active December 23, 2018 13:26
๋ผ๋ฉด๊ฐ€๊ฒŒ ํ•ดํ‚น
pic.png
@junhoyeo
junhoyeo / valid-rrn.py
Created January 29, 2019 01:58
์ฃผ๋ฏผ๋“ฑ๋ก๋ฒˆํ˜ธ ๊ฒ€์‚ฐ์— ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ํ•จ์ˆ˜
def check_valid(_id): # id='0000000000000'
'''Validate Korean RRN via last number'''
check = 0
for i in range(8):
check += (i+2)*int(_id[i])
for i in range(8, 12):
check += (i-6)*int(_id[i])
check = (11 - (check % 11)) % 10
if check == int(_id[12]):
return True
@junhoyeo
junhoyeo / pptx-bg.py
Last active June 16, 2019 02:19
PPT Output Images to PPTX backgrounds
from pptx import Presentation
from pptx.util import Inches
prs = Presentation()
prs.slide_width = 11887200
prs.slide_height = 6686550
title_slide_layout = prs.slide_layouts[0]
for i in range(1, int(input()):
slide = prs.slides.add_slide(title_slide_layout)
@junhoyeo
junhoyeo / search-dict-list.py
Created August 29, 2019 12:34
search list of dict from query string by all values
users = [{'name': 'a11', 'type': 'a11234'}, {'name':'bbb', 'type':'ddd'},{'name':'ccc','type':'ddvfa1'}]
[user for user in users if any(query in value for key, value in user.items())]
[{'name': 'a11', 'type': 'a11234'}, {'name': 'ccc', 'type': 'ddvfa1'}]
@junhoyeo
junhoyeo / save-score.h
Created November 12, 2019 12:51
์˜ค์˜์ค€๊ตฌ์›ํ•ด๋“œ๋ฆผ ์ ์šฉ์•Œ์•„์„œ
#pragma once
#ifndef _SAVE_SCORE_
#define _SAVE_SCORE_
#include <stdio.h>
// score.txt์—์„œ ํ˜„์žฌ ์ ์ˆ˜๋ฅผ ๊ฐ€์ ธ์˜จ๋‹ค.
int load_score() {
int score;
@junhoyeo
junhoyeo / generator.py
Last active February 14, 2020 08:02
LeeSBMath
from pprint import pprint
matrix = [[0] * 9 for _ in range(8)]
for row in range(8):
for col in range(9):
matrix[row][col] = col + row * 9
pprint(matrix)
@junhoyeo
junhoyeo / prob.py
Created March 13, 2020 11:02
1๋ถ€ํ„ฐ 10๊นŒ์ง€์˜ ์ž์—ฐ์ˆ˜๊ฐ€ ๊ฐ๊ฐ ํ•˜๋‚˜์”ฉ ์ ํžŒ ๊ตฌ์ˆ  10๊ฐœ ์ค‘ 4๊ฐœ๋ฅผ ์„ ํƒํ•  ๋•Œ 3์˜ ๋ฐฐ์ˆ˜๊ฐ€ ์ ํžŒ ๊ตฌ์Šฌ์ด ์ ์–ด๋„ ํ•œ ๊ฐœ ์„ ํƒ๋˜๋Š” ๊ฒฝ์šฐ์˜ ์ˆ˜
from itertools import combinations
marbles = list(range(1, 11))
combs = list(combinations(marbles, 4))
result = 0
for comb in combs:
if any(item % 3 == 0 for item in comb):
result += 1
print(result)
@junhoyeo
junhoyeo / kill-switch.json
Last active April 26, 2020 07:42
kill switch for something
{"status":"OFF","message":"."}