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
echo -e "\n\n" | |
TB_ARG='' | |
i=1 | |
for letter in {a..z}; do | |
if [ $i -lt $(($#+1)) ]; then | |
line="${letter}:${!i}" | |
echo -e $line | |
TB_ARG+="${line}/logs," |
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 f in `ls *`; do nc=${#f}; nc2=$((10-$nc)); if [ $nc2 -gt 0 ]; then preffix=`printf '0%.0s' $(seq 1 $nc2)`; newf=$preffix$f; mv $f $newf; fi; done |
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
convert $f -interpolate nearest-neighbor -interpolative-resize 352x288! $newf |
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 f in *; do file $f | sed 's/.*, \(.*\)x\(.*\),.*/\1x\2/'; done | sort | uniq -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
export UID=$(id -u) | |
export GID=$(id -g) | |
docker run --user $UID:$GID \ | |
--workdir="/home/$USER" \ | |
-v "/etc/group:/etc/group:ro" \ | |
-v "/etc/passwd:/etc/passwd:ro" \ | |
-v "/etc/shadow:/etc/shadow:ro" \ | |
-it $DOCKER_IMAGE |
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
def parse_args(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-d', type=str, help='directory path', dest='dpath') | |
parser.add_argument('-f', type=str, help='filepath', dest='fpath') | |
return parser.parse_args() | |
if __name__ == '__main__': | |
args = parse_args() | |
if not any([args.dpath, args.fpath]): |
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
# Code adapted from skimage | |
# https://github.com/riaanvddool/scikits-image/blob/master/skimage/color/delta_e.py#L123 | |
import numpy as np | |
import tensorflow as tf | |
def tf_deg2rad(deg): | |
return (deg / 180) * np.pi | |
def tf_rad2deg(rad): |
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
xgb_params = {'objective': 'multi:softmax', | |
'num_class': 19, | |
'tree_method': 'exact', | |
# 'max_bin': 64, | |
'colsample_bytree': 0.75, | |
'subsample': 0.75, | |
# 'lambda': 2, | |
# 'alpha': 2, | |
# 'min_child_weight': 10, | |
# 'max_delta_step': 10, |
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 traceback | |
import sys | |
try: | |
pass | |
except Exception as e: | |
traceback_info = ''.join(traceback.format_exception(*sys.exc_info())) | |
logger.info(traceback_info) |
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 logging | |
from logging.handlers import RotatingFileHandler | |
import traceback | |
logger = logging.getLogger() | |
logger.setLevel(logging.DEBUG) | |
handler = RotatingFileHandler('app.log', mode='a', maxBytes=50e6, backupCount=2) | |
formatter = logging.Formatter('%(asctime)s,%(message)s', datefmt='%Y-%m-%d %H:%M:%S') | |
handler.setFormatter(formatter) |
NewerOlder