This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from abc import ABCMeta, abstractmethod | |
class Observer(metaclass=ABCMeta): | |
@abstractmethod | |
def update(self, observable, object): | |
pass | |
class Observable: | |
def __init__(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for VirtualBox Debian | |
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Use Python decorator to measure run time. #python #decorator""" | |
import time | |
from functools import wraps | |
def timeit(func): | |
@wraps(func) | |
def measure_time(*args, **kwargs): | |
start_time = time.time() | |
result = func(*args, **kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
刪除 *.pyc, __pycache__ 資料夾, 並且遞迴刪除空資料夾 | |
""" | |
import os | |
from pathlib import Path | |
from argparse import ArgumentParser | |
def rmdir_btm2top(folder): | |
folder = Path(folder) |