Skip to content

Instantly share code, notes, and snippets.

View ShinJJang's full-sized avatar
๐ŸŽฏ
Focusing

shinjjang ShinJJang

๐ŸŽฏ
Focusing
View GitHub Profile
def solution(bridge_length, weight, truck_weights):
pos = []
wts = []
answer = 0
while(True):
if sum(wts) == 0 and len(truck_weights) == 0:
break
print(answer, pos, wts, truck_weights)
def solution(heights):
diff = []
for idx in range(len(heights)-1):
diff.insert(len(diff), heights[idx] - heights[idx+1])
receives = [0]
for idx in range(len(diff)):
recv = 0
for t in range(idx, -1, -1):
if sum(diff[t:idx+1]) > 0:
def solution(genres, plays):
g_count = {}
g_list = {}
for idx in range(len(genres)):
g = genres[idx]
g_count[g] = g_count.get(g, 0) + plays[idx]
sg_list = g_list.get(g, [])
sg_list.append((idx, plays[idx]))
g_list[g] = sg_list
def solution(clothes):
c_dict = {}
for name, part in clothes:
c_dict[part] = c_dict.get(part, 0) + 1
c_sum = list(c_dict.values())
answer = 1
for v in c_sum:
answer *= v + 1
def solution(phone_book):
phone_book = sorted(phone_book)
for idx in range(len(phone_book)-1):
a = phone_book[idx]
b = phone_book[idx+1]
if len(a) <= len(b) and a == b[:len(a)]:
return False
return True
def solution(participant, completion):
answer = ''
count_dict = {}
for p in participant:
count_dict[p] = count_dict.get(p, 0) + 1
for c in completion:
count_dict[c] = count_dict.get(c, 0) - 1
@ShinJJang
ShinJJang / get_pr_list.py
Last active July 9, 2020 09:14
Get pull requests with PyGithub, python3 ๐Ÿ“’
#!/usr/bin/env python3
from github import Github
token = 'YOUR TOKEN' # https://github.com/settings/tokens
username = 'YOUR USERNAME'
organization = 'YOUR TEAM'
gh = Github(token) # or Github(username, password)
query = 'org:{} is:merged'.format(organization) # https://help.github.com/en/articles/searching-issues-and-pull-requests
/**********************
* fordingTheRiver.js *
**********************
*
* And there's the river. Fortunately, I was prepared for this.
* See the raft on the other side?
*
* Everything is going according to plan.
*/
@ShinJJang
ShinJJang / Understanding Kubernetes internals.md
Last active November 20, 2018 15:03
Kubernetes in action 11.Understanding Kubernetes internals ์ •๋ฆฌ

11. Understanding Kubernetes internals

11.1.6 ์ปจํŠธ๋กค๋Ÿฌ ๋งค๋‹ˆ์ €์—์„œ ๋™์ž‘ํ•˜๋Š” ์ปจํŠธ๋กค๋Ÿฌ ์†Œ๊ฐœ

  • (์ด์ „์—๋„ ์–ธ๊ธ‰ํ–ˆ์ง€๋งŒ) API ์„œ๋ฒ„๋Š” etcd์— ์ €์žฅํ•˜๊ฑฐ๋‚˜, client ๋“ค์—๊ฒŒ ๋ณ€ํ™”๋ฅผ ์•Œ๋ฆฌ๋Š” ๊ฒƒ ์™ธ์—๋Š” ํ•˜์ง€ ์•Š์Œ!
  • ์Šค์ผ€์ฅด๋Ÿฌ๋Š” ๋‹จ์ง€ Node๋ฅผ Pod์— ํ• ๋‹นํ•จ
  • ์ปจํŠธ๋กค ๋งค๋‹ˆ์ € ์•ˆ์˜ ์ปจํŠธ๋กค๋Ÿฌ๋“ค์ด ๋ฐฐํฌ๋œ ๋ฆฌ์†Œ์Šค๋“ค์˜ ์ ์ ˆํ•œ ์ƒํƒœ๋กœ ์œ ์ง€ํ•จ
  • ํ•˜๋‚˜์˜ ์ปจํŠธ๋กค ๋งค๋‹ˆ์ € ํ”„๋กœ์„ธ์Šค๋Š” ๋‹ค์–‘ํ•œ ์ž‘์—…๋“ค์„ ์กฐ์ •ํ•˜๋Š” ์—ฌ๋Ÿฌ ์ปจํŠธ๋กค๋Ÿฌ๋“ค์„ ๊ทœํ•ฉํ•ฉ๋‹ˆ๋‹ค.
  • ๊ฐ ์ปจํŠธ๋กค๋Ÿฌ๋Š” ์ง์ ‘ ๊ตฌํ˜„ํ•œ ์ปจํŠธ๋กค๋Ÿฌ๋กœ ๋Œ€์ฒด๋  ์ˆ˜ ์žˆ์Œ

์ปจํŠธ๋กค๋Ÿฌ ๋งค๋‹ˆ์ €์— ํฌํ•จ๋˜๋Š” ์ปจํŠธ๋กค๋Ÿฌ๋“ค

@ShinJJang
ShinJJang / Kubernetes in action 2.5 Service.md
Created September 30, 2018 08:14
๋ฐœ๋ฒˆ์—ญ ์ •๋ฆฌ

Kubernetes in action

5. Services: ํด๋ผ์ด์–ธํŠธ๊ฐ€ Pod์„ ์ฐพ๊ณ  ํ†ต์‹ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๊ธฐ

์ด ์ฑ•ํ„ฐ๋กœ ๋ฐฐ์šธ ๊ฒƒ

  • ์„œ๋น„์Šค ๋ฆฌ์†Œ์Šค๋ฅผ ๋งŒ๋“ค๊ณ , Pod ๊ทธ๋ฃน์„ ํ•˜๋‚˜์˜ ์ฃผ์†Œ๋กœ ๋…ธ์ถœํ•˜๊ธฐ
  • ํด๋Ÿฌ์Šคํ„ฐ์—์„œ ์„œ๋น„์Šค๋ฅผ ์ฐพ๊ธฐ
  • ์„œ๋น„์Šค๋ฅผ ์™ธ๋ถ€ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ๋…ธ์ถœํ•˜๊ธฐ
  • ์™ธ๋ถ€ ์„œ๋น„์Šค๋ฅผ ๋‚ด๋ถ€ ํด๋Ÿฌ์Šคํ„ฐ์™€ ์—ฐ๊ฒฐํ•˜๊ธฐ
  • Pod์ด ์„œ๋น„์Šค์˜ ์ผ๋ถ€๋กœ ์ค€๋น„๋˜์—ˆ๋Š”์ง€๋ฅผ ์ปจํŠธ๋กคํ•˜๊ธฐ
  • ์„œ๋น„์Šค ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ