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
#!/bin/bash | |
set -o noglob # prevent bash from auto glob file extensions | |
set -e # exit if any commands yield error | |
# constants | |
readonly CRed='\033[0;31m' # Red | |
readonly CGreen='\033[0;32m' # Green | |
readonly CYellow='\033[0;33m' # Yellow | |
readonly CBlue='\033[0;34m' # Blue | |
readonly CWhite='\033[0;37m' # White |
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
PROMPT="%{$fg_bold[green]%}$USER::" | |
PROMPT+='%{$fg[cyan]%}%~%{$reset_color%} $(git_prompt_info)' | |
PROMPT+="%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})➜ %{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
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
import os | |
import sys | |
import logging | |
from datetime import datetime, timedelta | |
import pytz | |
def local_time(sec, what, tz="Asia/Ho_Chi_Minh"): | |
"""get datetime now with viet name timezone for logger""" | |
lc_time = datetime.now(tz=pytz.timezone(tz)) |
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
%load_ext autoreload | |
%autoreload 2 | |
import pandas as pd | |
pd.set_option('display.max_rows', 500) | |
pd.set_option('display.max_columns', 500) | |
pd.set_option('display.width', 1000) | |
import numpy as np |
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 pathlib import Path | |
from glob import glob | |
Path.ls = lambda x : [o.name for o in x.iterdir()] | |
Path.ls_p = lambda x : [str(o) for o in x.iterdir()] | |
Path.str = lambda x : str(x) | |
def insensitive_glob(root, pattern): | |
def either(c): | |
return '[%s%s]' % (c.lower(), c.upper()) if c.isalpha() else c |
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 contextlib import contextmanager | |
import time | |
@contextmanager | |
def timing(description: str = '') -> None: | |
start = time.time() | |
yield | |
print(f"Elasped {description}: {time.time() - start}") | |
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 fastai.vision import Image,pil2tensor | |
import cv2 | |
def array2tensor(x): | |
""" Return an tensor image from cv2 array """ | |
x = cv2.cvtColor(x,cv2.COLOR_BGR2RGB) | |
return Image(pil2tensor(x,np.float32).div_(255)) | |
### USAGE |
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
import requests | |
import matplotlib.pyplot as plt | |
from PIL import Image | |
from matplotlib import patches | |
from io import BytesIO | |
face_api_url = _url # https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect | |
headers = {'Content-Type': 'application/octet-stream', 'Ocp-Apim-Subscription-Key': subscription_key} | |
params = { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
h5py | |
keras | |
numpy | |
pandas | |
pillow | |
scikit-learn | |
scipy | |
scrapy | |
seaborn | |
tensorboard |