Skip to content

Instantly share code, notes, and snippets.

View leopard627's full-sized avatar
🎯
Focusing

Leopard627 leopard627

🎯
Focusing
View GitHub Profile
@leopard627
leopard627 / docker service update
Created January 14, 2020 02:47
docker swarm update example
docker service update \
--update-parallelism 1 \
--update-delay 5s \
--update-order stop-first \
--image 460957833:나의 이미지 예시 \
--force \
--with-registry-auth \
api
docker service update \
--update-parallelism 1 \
--update-delay 5s \
--update-order stop-first \
--image 460957833:나의 이미지 예시 \
--force \
--with-registry-auth \
api
docker service update \
--update-parallelism 1 \
--update-delay 5s \
--update-order stop-first \
--image { your docker iamge } \
--force \
--with-registry-auth \
api
docker service create \
--name=api \
--replicas=4 \
--detach=true \
--network={YOUR NET WORK} \
--publish 80:80 \
--publish 443:80 \
--with-registry-auth \
--label com.docker.aws.lb.arn=arn:aws:acm:ap-no{YOUR: AWS : ARN ! ! !} \
@leopard627
leopard627 / your_reducer.py
Last active February 4, 2020 15:50
learning_python_example
def youreducer(func, seq):
tally = seq[0]
for next in seq[1:]:
tally = func(tally, next)
return tally
def add(x, y):
return x + y
@leopard627
leopard627 / python_reducer.py
Created February 4, 2020 15:41
learning_python example
import operator, functools
functools.reduce(operator.add, [1, 2, 3, 4, 5])
>> 15
functools.reduce((lambda x, y: x + y), [1, 2, 3, 4, 5])
>> 120
@leopard627
leopard627 / your_reducer.py
Created February 4, 2020 15:50
your_reducer.py
def youreducer(func, seq):
tally = seq[0]
for next in seq[1:]:
tally = func(tally, next)
return tally
def add(x, y):
return x + y
@leopard627
leopard627 / your_reducer.py
Created February 4, 2020 15:50
your_reducer.py
def youreducer(func, seq):
tally = seq[0]
for next in seq[1:]:
tally = func(tally, next)
return tally
def add(x, y):
return x + y
@leopard627
leopard627 / map1.py
Created February 13, 2020 05:05
pure python map v1
def myfunc(func, *args):
res = []
for args in zip(*args):
res.append(func(*args))
return res
myfunc(abs, [-1, 2, 3])
>> [1, 2, 3]
myfunc(abc, [-1, -2, -3]
def myfunc(func, *args):
return [func(*arg)for arg in zip(*args)]