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
| cd /datadrive2/project_data/CCTH/sku_classify/train/cropped_images | |
| find . -name "*.jpg" > /tmp/train.txt | |
| cat /tmp/train.txt | awk -F/ '{print $2}' > /tmp/label.txt | |
| cat /tmp/train.txt | sed 's/^\./cropped_images/g' > /tmp/train_tmp.txt | |
| echo -e "name,label\n$(paste -d "," /tmp/train_tmp.txt /tmp/label.txt)" > /tmp/train.csv |
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
| port=$1; shift; | |
| passwd=$1; shift; | |
| yum check-update | |
| curl -fsSL https://get.docker.com/ | sh | |
| systemctl start docker | |
| systemctl enable docker | |
| docker pull shadowsocks/shadowsocks-libev | |
| docker run -e PASSWORD=${passwd} -e METHOD=chacha20-ietf-poly1305 -p${port}:8388 -p${port}:8388/udp -d --restart always shadowsocks/shadowsocks-libev |
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
| service mongod stop | |
| mkdir /ebs-volume01/mongo | |
| chmod -R 755 /ebs-volume01/mongo | |
| chown -R mongod:mongod /ebs-volume01/mongo | |
| vim /etc/mongod.conf # change systemLog.path to /ebs-volume01/mongo/log/mongod.log and change storage.dbPath /ebs-volume01/mongo | |
| semanage fcontext -a -t mongod_var_lib_t '/ebs-volume01/mongo.*' | |
| chcon -Rv -u system_u -t mongod_var_lib_t '/ebs-volume01/mongo' | |
| restorecon -R -v '/ebs-volume01/mongo' |
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
| #!/usr/bin/env bash | |
| set -x | |
| black=$1 | |
| input_file=$2 | |
| start_line=$3 | |
| end_line=$4 | |
| # Read selected lines and write to tmpfile |
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 | |
| # apt -y install unzip | |
| # install besttrace | |
| if [ ! -f "besttrace" ]; then | |
| wget https://github.com/wn789/VPS-/raw/master/besttrace | |
| # unzip besttrace4linux.zip | |
| chmod +x besttrace | |
| fi |
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
| {n01440764: 'tench, Tinca tinca', | |
| n01443537: 'goldfish, Carassius auratus', | |
| n01484850: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
| n01491361: 'tiger shark, Galeocerdo cuvieri', | |
| n01494475: 'hammerhead, hammerhead shark', | |
| n01496331: 'electric ray, crampfish, numbfish, torpedo', | |
| n01498041: 'stingray', | |
| n01514668: 'cock', | |
| n01514859: 'hen', | |
| n01518878: 'ostrich, Struthio camelus', |
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
| {0: 'tench, Tinca tinca', | |
| 1: 'goldfish, Carassius auratus', | |
| 2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
| 3: 'tiger shark, Galeocerdo cuvieri', | |
| 4: 'hammerhead, hammerhead shark', | |
| 5: 'electric ray, crampfish, numbfish, torpedo', | |
| 6: 'stingray', | |
| 7: 'cock', | |
| 8: 'hen', | |
| 9: 'ostrich, Struthio camelus', |
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
| exp_port=$1; shift; # port to expose | |
| passwd=$1; | |
| sudo apt update | |
| sudo apt install -y vim git software-properties-common curl | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
| sudo apt-get update |
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 numpy as np | |
| import cv2 | |
| import matplotlib.pyplot as plt | |
| def linear_transform(x, src_range=(360, 719), dest_range=(16, 60)): | |
| src_width, dest_width = src_range[1] - src_range[0], dest_range[1] - dest_range[0] | |
| return dest_range[1] - (src_range[1] - x) / src_width * dest_width | |
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 collections import namedtuple | |
| import leven # install through pip first | |
| import numpy as np | |
| SparseTensor = namedtuple('SparseTensor', 'indices vals shape') | |
| PHN_MAPPING = {'iy': 'iy', 'ix': 'ix', 'ih': 'ix', 'eh': 'eh', 'ae': 'ae', 'ax': 'ax', 'ah': 'ax', | |
| 'ax-h': 'ax', 'uw': 'uw', 'ux': 'uw', 'uh': 'uh', 'ao': 'ao', 'aa': 'ao', 'ey': 'ey', |