Skip to content

Instantly share code, notes, and snippets.

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

μ •μŠΉμ› aliwo

🏠
Working from home
View GitHub Profile
@aliwo
aliwo / hi.py
Last active February 15, 2019 12:17
κ°€μœ„λ°”μœ„λ³΄!
# hi
@aliwo
aliwo / holleywood.py
Last active May 24, 2019 03:15
ν• λ¦¬μš°λ“œ 법칙
class Mother:
my_varialbe = 3
def _func(self):
print('func 호좜')
def func_caller(self):
print('여기에 둜그λ₯Ό μ“°λ©΄ λ©λ‹ˆλ‹€: {}'.format(self.my_variable))
self.func()
@aliwo
aliwo / sums.py
Created May 25, 2019 13:11
μž¬κ·€ν˜ΈμΆœ sum κ³Ό 뢄할정볡 sum
import dis
def recursive_sum(n):
print('recursive 호좜', n)
if n == 1:
return 1
return n + recursive_sum(n-1)
def alter_alpha(to):
num = ord(to)
return num - 65 if num < 79 else 90 - num + 1
def traverse(done, i):
# TODO ; left_cnt 보닀 right_cnt κ°€ 크면 right 탐색을 쀑단 ν•˜λŠ” μ΅œμ ν™”κ°€ κ°€λŠ₯ν• κΉŒ? 닡에 영ν–₯이 μ—†μ„κΉŒ?
# κΈ°μ € 사둀
if False not in done:
package buv.co.kr.util.youtube;/*
* Copyright (c) 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
solution = lambda t, l = []: max(l) if not t else solution(t[1:], [max(x,y)+z for x,y,z in zip([0]+l, l+[0], t[0])])
# μ’…λ§ŒλΆμ—μ„œ ν’€μ—ˆλ˜ 문제. μ‚Όκ°ν˜• λͺ¨μ–‘λ§Œ λ‹€λ₯΄λ‹€.
# cache[i][j] 보닀 f μŠ€νŠΈλ§μ„ μ‚¬μš©ν•œ 1쀑 dict κ°€ 훨씬 λΉ λ₯΄λ‹€.
# 이게 반볡으둜 ν’€ 수 μžˆλŠ” λ¬Έμ œμΈκ°€?
cache = {}
def move(triangle, i, j):
'''
ν˜„μž¬ μœ„μΉ˜μ—μ„œ 내렀갔을 λ–„ 얻을 수 μžˆλŠ” μ΅œλŒ“κ°’μ„ λ°˜ν™˜ν•©λ‹ˆλ‹€.
# ν•œ 쀄 짜리 μ†”λ£¨μ…˜ 해석
def solution(t, l = []):
if not t: # νƒˆμΆœ 쑰건. μ‚Όκ°ν˜•μ„ μ „λΆ€ μ†Œλͺ¨ν•œλ‹€.
return max(l)
result = []
for x, y, z in zip([0]+l, l+[0], t[0]): # [0] + l = 0 λ”ν•˜κΈ° 리슀트
# zip 은 리슀트λ₯Ό n 개 λ°›μ•„μ„œ 각 리슀트 λ§ˆλ‹€ foreach λ₯Ό λŒμ•„μ€˜μš”
# for a, b, c in zip(A, B, C) 이면 a λŠ” A의 μš”μ†Œ, b λŠ” B의 μš”μ†Œ, c λŠ” C의 μš”μ†Œ
result.append(max(x, y) + z) # result 에 ν•˜λ‚˜μ”© 더함
import sys , os
sys.path.append(os.pardir)
from dataset.mnist import load_mnist
from common.functions import sigmoid, softmax, np
def get_data():
(x_train, t_train), (x_test, t_test)=\
load_mnist(normalize=True, flatten=True, one_hot_label=True)
return x_train, t_train
#!/usr/bin/env python
import flask
from flask import request, jsonify
from os import path, environ
from raven.contrib.flask import Sentry
import cv2
import numpy as np
import requests