⋊> ~/c/docker-compose cat docker-compose.yaml 16:33:48
services:
test:
image: nvidia/cuda:11.3.1-cudnn8-devel-ubuntu20.04
command: nvidia-smi
environment:
- NVIDIA_DISABLE_REQUIRE=1
deploy:
resources:
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
# compress/decompress zip file. | |
zip file.csv.zip file.csv | |
unzip file.csv.zip | |
# compress/decompress gz file. | |
gzip file.csv | |
gzip -d file.csv.gz | |
# compress/decompress bz2 file. | |
bzip2 file.csv |
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 pandas as pd | |
import locale | |
from locale import atof | |
df = pd.DataFrame([['1,200', '4,200'], ['7,000', '-0.03'], ['5', '0']], | |
columns=['col1', 'col2']) | |
# col1 col2 | |
# 0 1,200 4,200 | |
# 1 7,000 -0.03 | |
# 2 5 0 |
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 matplotlib.pyplot as plt | |
from sklearn.metrics import roc_curve, auc | |
import seaborn as sns | |
sns.set('talk', 'whitegrid', 'dark', font_scale=1.5, font='Ricty', | |
rc={"lines.linewidth": 2, 'grid.linestyle': '--'}) | |
fpr, tpr, _ = roc_curve([1, 0, 1, 0, 1, 0, 0], [0.9, 0.8, 0.7, 0.7, 0.6, 0.5, 0.4]) | |
roc_auc = auc(fpr, tpr) |
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
# pip install the unreleased main repository | |
git clone https://github.com/pypa/pipenv.git | |
python setup.py develop --user | |
# or below command | |
pip install git+https://github.com/pypa/pipenv.git --user | |
# add PATH for fish shell | |
set -U fish_user_paths /home/anasys/.local/bin $fish_user_paths |
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
# delete pillow package | |
emacs Pipfile | |
# delete below package | |
# [packages] | |
# pillow | |
pipenv clean | |
# install pillow package | |
emacs Pipfile | |
# add below package |
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
# I refer to "git --How do I update my bare repo? --Stack Overflow https://stackoverflow.com/questions/3382679/how-do-i-update-my-bare-repo" | |
# Create mirror repository | |
git clone --bare https://github.com/Keiku/test1.git | |
cd test1.git | |
git push --mirror https://github.com/Keiku/test2.git | |
# Promote development with mirror repository | |
cd ../ | |
git clone https://github.com/Keiku/test2.git |
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 numpy as np | |
# sample array | |
array = np.array([[1, 1, 1, 0, 0, 0], | |
[1, 1, 1, 0, 0, 0]]) | |
# get row index and col index | |
rows, cols = np.where(array == 1) | |
# Convert row index and column index to 2d array | |
np.transpose((rows, cols)) | |
# array([[0, 0], |
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 | |
path = pathlib.Path('home/path/to/file.txt') | |
root = path.parent.parent | |
# PosixPath('home/path') | |
path.relative_to(root) | |
# PosixPath('to/file.txt') |
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
# Reference: 1. Getting Started with Pre-trained Model from RetinaFace — insightface 0.1.5 documentation http://insightface.ai/build/examples_face_detection/demo_retinaface.html | |
# How to install insightface | |
# pip install insightface | |
# pip install mxnet-cu100 | |
import insightface | |
import urllib | |
import urllib.request | |
import cv2 | |
import numpy as np |
NewerOlder