Skip to content

Instantly share code, notes, and snippets.

View patharanordev's full-sized avatar
🤝
Focusing

PatharaNor patharanordev

🤝
Focusing
View GitHub Profile
@patharanordev
patharanordev / run-ios-dotnet7-maui-mac-m1.md
Created February 9, 2024 12:53
Run App on iOS14.2 simulator by using MAUI .NET v7.0 on macOS M1

Run App on iOS14.2 simulator by using MAUI .NET v7.0 on macOS M1

Note: Multi-platform Application UI (MAUI).

Requirements

  • .NET v7 (compat with MS iOS SDK 16.2)
  • Visual Studio 2022
  • iOS simulator 14.2
  • macOS M1
@patharanordev
patharanordev / nestjs.Dockerfile
Created September 16, 2023 12:16
Reduce size of Dockerized NestJS from 7XXMB to 185MB
# -------------------------------------------
# Prepare runner
FROM node:18-alpine AS runner
RUN apk update && \
apk add curl bash g++ make && \
rm -rf /var/cache/apk/*
# Install node-prune (https://github.com/tj/node-prune)
@patharanordev
patharanordev / react-native-require-gradle-high-ver.md
Created March 4, 2023 13:55
React Native | fixing The Android Gradle plugin supports only kotlin-android-extensions Gradle plugin version x.y.z and higher

React Native : kotlin-android-extensions Gradle plugin version x.y.z and higher

Example error log :

...
BUILD FAILED in 31s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
@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
@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 / 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) || : ) && \

Compress with 7zip in Ultra mode on MacOS

Requires p7zip :

$ brew install p7zip

Compress :

@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) {
@patharanordev
patharanordev / image-gallery-in-notebook.md
Created September 26, 2021 15:34
List image in Jupyter notebook

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