Skip to content

Instantly share code, notes, and snippets.

View AnechaS's full-sized avatar
😀
Hello

Anecha Kuekharem AnechaS

😀
Hello
  • True Digital Group
  • Thailand
  • 19:22 (UTC +07:00)
View GitHub Profile
@AnechaS
AnechaS / Dockerfile
Last active May 12, 2023 12:15
Docker apache httpd server with SSL/HTTPS and HTTP support.
FROM httpd:2.4
COPY httpd.conf /usr/local/apache2/conf/httpd.conf
COPY index.html /usr/local/apache2/htdocs/index.html
RUN apt-get update \
&& apt-get -y install openssl \
&& cd /usr/local/apache2/conf \
&& openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout server.key -out server.crt -subj '/CN=localhost'
@AnechaS
AnechaS / docker-compose.yml
Last active May 12, 2023 08:56
docker-compose config for elasticsearch and kibana
version: '3.8'
services:
elasticsearch:
container_name: es
image: docker.elastic.co/elasticsearch/elasticsearch:8.4.3
environment:
- xpack.security.enabled=false
- "discovery.type=single-node"
networks:
@AnechaS
AnechaS / index.js
Last active April 25, 2023 15:01
JavaScript Get object value by path
/**
* Get the object value by path
* @param {object} obj
* @param {string} path
* @return {any}
* @example
* getObjectValue({ str: 'string', int: 0 }, 'str'); //=> 'string'
* getObjectValue({ obj: { str: 'string', int: 0 } }, 'obj.str'); //=> 'string'
* getObjectValue({ arr: [{ str: 'string', int: 0 }] }, 'obj[0].str'); //=> 'string'
* getObjectValue({ arr: [{ str: 'string', int: 0 }] }, 'obj[*].str'); //=> ['string']
@AnechaS
AnechaS / findPropertyPathWithValue.js
Last active April 25, 2023 15:01
Javascript find property path in object with a value.
/**
* Find property path in the object with a value
* @param {object} obj
* @param {any} value
* @return {string}
*/
function findPropertyPathWithValue(obj, value) {
for (const key in obj) {
if (JSON.stringify(value) === JSON.stringify(obj[key])) {
return key;