Skip to content

Instantly share code, notes, and snippets.

View patharanordev's full-sized avatar
🤝
Focusing

PatharaNor patharanordev

🤝
Focusing
View GitHub Profile

Solved ImportError: libGL.so.1: cannot open shared object file: No such file or directory

When using cv2 in Dockerfile.

Adding library below to your Dockerfile to solve the issue :

RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6  -y
@patharanordev
patharanordev / press-to-continue.sh
Created April 10, 2021 13:55
Simple press key to continue new shell script
echo "Press 'q' to continue"
count=0
while : ; do
read -n 1 k <&1
if [[ $k = q ]] ; then
break
fi
done
@patharanordev
patharanordev / coco.sh
Created April 18, 2021 03:41 — forked from mkocabas/coco.sh
Download COCO dataset. Run under 'datasets' directory.
mkdir coco
cd coco
mkdir images
cd images
wget http://images.cocodataset.org/zips/train2017.zip
wget http://images.cocodataset.org/zips/val2017.zip
wget http://images.cocodataset.org/zips/test2017.zip
wget http://images.cocodataset.org/zips/unlabeled2017.zip

Crop image from YOLOv4+'s label(Darknet annotation)

def get_yolo_image_box(line, img_width, img_height):
    '''
    Ref. https://www.ccoderun.ca/programming/darknet_faq/#darknet_annotations
    '''
    columns = line.split(' ')
    class_id = columns[0]
 center_x = float(columns[1]) * img_width
@patharanordev
patharanordev / image-gallery-in-notebook.md
Created September 26, 2021 15:34
List image in Jupyter notebook
@patharanordev
patharanordev / stop-service-by-name.ps1
Created November 1, 2021 11:25
Using PowerShell to stop specific service by process ID from the service name
Function GetServiceByName {
Param (
[string]$ServiceName
)
return Get-WmiObject -Class Win32_Service -Filter "Name LIKE '$ServiceName'" | Select-Object -ExpandProperty ProcessId
}
$nid = GetServiceByName -ServiceName "notepad"
If ($nid -ne 0) {

Compress with 7zip in Ultra mode on MacOS

Requires p7zip :

$ brew install p7zip

Compress :

@patharanordev
patharanordev / terminate-other-container.md
Created January 8, 2022 09:57
Terminate the other container after main container run finished by using docker-compose

Terminate the other container after main container run finished by using docker-compose

Example : I would like to terminate node and filebeat service after test service run finished or exit code is zero (success). We need to create shell script and adding two docker-compose up's options, it's --abort-on-container-exit and --exit-code-from (the shell script below related with docker-container.yml)

shell-scrip.sh

( (docker-compose -f docker-compose.yml down -v) || : ) && \
@patharanordev
patharanordev / uninstall-cuda-on-mac.md
Created June 4, 2022 03:13
Uninstall CUDA.framework on macOS

Uninstall CUDA.framework on macOS

If you

  • got message like "CUDA.framework is malware, ... damage on your mac"
  • using OpenCL instead
  • using macOS 10.14+ (used Metal framework instead)

and try to remove it.

Delete the following folders/files:

@patharanordev
patharanordev / update-docker-compose.sh
Last active November 28, 2022 10:05
Update Docker compose version
VERSION=2.1.1
rm -rf ~/docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/$VERSION/docker-compose-$(uname -s)-$(uname -m)" -o ~/docker-compose
sudo chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
docker-compose -v