Skip to content

Instantly share code, notes, and snippets.

  • 比較Supervisor 和DynamicSupervisor的差異性
  • 了解child_spec裡的內容
#!/bin/bash
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [[ ${current_branch} == "master" ]]
then
echo "pull ${current_branch}"
git fetch
git pull origin ${current_branch}
elif [[ ${current_branch} == "staging" ]]
then
@allenyang79
allenyang79 / atom.clj
Created January 7, 2020 00:57
clojure-cheetsheet
; declare a atom var
(def x (atom 5))
; get value of atom
@x
; change atom's value
(swap! x inc)
; reset
import time
import wrapt
import random
import weakref
def cache_it(keyfn):
cache = weakref.WeakKeyDictionary()
@wrapt.decorator
import wrapt
import logging
@wrapt.decorator
def trace_it(wrapped, instance, args, kwargs):
import time
begin_at = time.time()
ret = wrapped(*args, **kwargs)
import time
import wrapt
import contextlib
import weakref
import functools
class Cacher:
def __init__(self):
@allenyang79
allenyang79 / 00.md
Last active April 6, 2021 03:44
python ariadne usage

python ariadne usage

@allenyang79
allenyang79 / ex01.py
Last active October 24, 2019 06:09
wrapt
import wrapt
@wrapt.decorator
def pass_through(wrapped, instance, args, kwargs):
print("pass_through", wrapped, instance, args, kwargs)
return wrapped(*args, **kwargs)
@pass_through
def foo():
from injector import Injector, Key, inject
Sizes = Key('sizes')
Names = Key('names')
class A:
@inject
def __init__(self, number: int, names: Names, sizes: Sizes):
print("init A", [number, names, sizes])
self.number = number