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
| # install | |
| # pip3 install pandas | |
| # pip3 install xlrd | |
| # pip3 install openpyxl | |
| import pandas as pd | |
| from glob import glob | |
| import argparse | |
| import os | |
| from multiprocessing import Pool, cpu_count |
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 https://www.youtube.com/watch?v=OyfBQmvr2Hc | |
| (define eval-expr | |
| (lambda (expr env) | |
| (pmatch expr | |
| [,x (guard (symbol? x)) | |
| (env x)] | |
| [(lambda (,x) ,body) | |
| (lambda arg) | |
| (eval-expr body (lambda (y) |
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
| /* | |
| # PigeonLab Engineering Test | |
| ## Overview | |
| Your task is to create a TCP based calculator service and deploy it. It'll take | |
| in simple math operations such as `1+1`, or `5*10` and reply with the answer. | |
| You should implement the server in node.js, with no dependancies, and in a single |
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 |