⋊> ~/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
# 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 |
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: python - Reading csv containing a list in Pandas - Stack Overflow https://stackoverflow.com/questions/20799593/reading-csv-containing-a-list-in-pandas | |
# Copy this text. | |
""" | |
HK,"[u'5328.1', u'5329.3', '2013-12-27 13:58:57.973614']" | |
HK,"[u'5328.1', u'5329.3', '2013-12-27 13:58:59.237387']" | |
HK,"[u'5328.1', u'5329.3', '2013-12-27 13:59:00.346325']" | |
""" | |
import ast |
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 itertools | |
['%s%s' % (x, y) for x, y in itertools.product(['a', 'b'], ['1', '2'])] | |
# ['a1', 'a2', 'b1', 'b2'] |
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
# Remove S3 files before the specified last update time | |
# Reference: amazon s3 - aws cli s3 bucket remove object with date condition - Stack Overflow https://stackoverflow.com/questions/51375531/aws-cli-s3-bucket-remove-object-with-date-condition | |
aws s3 ls --recursive s3://path/to/ | awk '$1 < "2020-06-25 12:00:00" {print $4}' | xargs -n1 -t -I 'KEY' aws s3 rm s3://path/to/'KEY' |
NewerOlder