Skip to content

Instantly share code, notes, and snippets.

View vanquyet94's full-sized avatar

Nguyễn Văn Quyết vanquyet94

View GitHub Profile
/**
* Validates hex value
* @param {String} color hex color value
* @return {Boolean}
*/
function isValidHex(color) {
if(!color || typeof color !== 'string') return false;
// Validate hex values
if(color.substring(0, 1) === '#') color = color.substring(1);
@vanquyet94
vanquyet94 / import.md
Created May 26, 2022 10:08 — forked from geraldvillorente/import.md
How to import database in MySQL in Docker?

This is a simple way of importing MySQL database in Docker.

  1. In you Dockerfile you must have a shared folder. Shared folder is a directory in your host machine that is mounted to Docker instance.

  2. Put the exported sql file in the shared folder.

  3. Login to your Docker instance via docker exec -it DOCKER_CONTAINER_ID bin/bash.

  4. Login to MySQL via mysql -u USERNAME -p.

@vanquyet94
vanquyet94 / cluster-worker-id.js
Created September 27, 2022 04:30 — forked from ando-takahiro/cluster-worker-id.js
what is cluster.worker.id?
var cluster = require('cluster');
if (cluster.isMaster) {
for (var i = 0; i < 4; ++i) {
cluster.fork();
}
} else {
console.log(process.pid, cluster.worker.id);
}
@vanquyet94
vanquyet94 / README.md
Created May 6, 2023 13:43 — forked from abelcallejo/README.md
Installing GDAL 3.2.1 on Amazon Linux 2

Installing GDAL 3.2.1 on Amazon Linux 2

gdal linux yum

As of this day, this is probably the only and fastest way of installing it.

Package requirements

Based from the GDAL and PROJ build requirements, here is the full list of required packages to install: