This file contains 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
# -v, --verbose | |
# -a, --archive want recursion and preserve almost everything | |
# -P same as --partial --progress | |
# -z, --compress compress file data during the transfer | |
rsync -vaPz file.txt user@server:~/user | |
rsync -vaPz dir user@server:~/user |
This file contains 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
cat input/squad20/dev-v2.0.json | jq '.data[].paragraphs[].qas[] | select(.id=="5ad24ce8d7d075001a428c0e")' -C | less -r | |
cat input/squad20/dev-v2.0.json | jq ".data[].title" -C | less -r | |
cat input/squad20/dev-v2.0.json | jq ".data[].paragraphs[].qas[].id" -C | less -r | |
cat input/squad20/dev-v2.0.json | jq ".data[].paragraphs[].qas[].id" -C | grep -ni 'needle' | |
This file contains 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
index = df[df["title"].str.len() == 0].index | |
df.drop(index=index, inplace=True) | |
index = df[df["is_disamb"] == 1].index | |
df.drop(index=index, inplace=True) |
This file contains 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 logging | |
from logging.config import fileConfig | |
LOG_INI = CONF[ENVIRONMENT]["LOG_INI"] | |
LOG_DIR = CONF[ENVIRONMENT]["LOG_DIR"] | |
def get_logger(name: str = None): | |
logging.config.fileConfig(LOG_INI, defaults={"logdir": LOG_DIR}) |
This file contains 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
2xu | |
3com | |
3d younique | |
3m | |
3m scotchlite | |
4head | |
5 star | |
55 soul | |
81 customs | |
81stgeneration |
This file contains 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
def safe_func(default_value=None): | |
def decorate(f): | |
@functools.wraps(f) | |
def wrapper(*args, **kwds): | |
try: | |
res = f(*args, **kwds) | |
except: | |
res = default_value | |
return res | |
return wrapper |
This file contains 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
%%time | |
len1 = len(train) | |
train["col"] = train["col"].str.strip() | |
train.drop(train[train["col"].str.len() == 0].index, inplace=True) | |
len2 = len(train) | |
print(f"{len1 - len2} rows deleted") |
This file contains 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 pathlib | |
from datetime import datetime | |
ts = datetime.now().strftime('%Y%m%d_%H%M%S') | |
job_dir = f"models/mlp/{ts}" | |
pathlib.Path(job_dir).mkdir(parents=True, exist_ok=True) |
This file contains 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
pd.set_option("use_inf_as_na", True) | |
pd.set_option("max_info_columns", 9999) | |
pd.set_option("display.max_columns", 9999) | |
pd.set_option("display.max_rows", 9999) | |
pd.set_option('max_colwidth', 9999) |