Skip to content

Instantly share code, notes, and snippets.

View orpheousff8's full-sized avatar
🤪
crazy

Saracha Tongkumpunt orpheousff8

🤪
crazy
  • Bangkok
View GitHub Profile
@orpheousff8
orpheousff8 / docker-compose.yml
Last active May 1, 2021 13:49
Wordpress Apache
version: '3.1'
services:
wordpress:
container_name: WORDPRESS_CONTAINER_NAME
image: wordpress:5.7-apache
restart: always
volumes:
- ./wordpress:/var/www/html
ports:
@orpheousff8
orpheousff8 / docker-compose.yml
Last active May 1, 2021 15:05
Wordpress Nginx
version: '3.1'
services:
nginx:
container_name: NGIX_CONTAINER_NAME
image: nginx:1.18.0-alpine
restart: always
volumes:
- ./config/nginx/vhost.conf:/etc/nginx/conf.d/default.conf
- ./log/nginx:/var/log/nginx
@orpheousff8
orpheousff8 / readCsv.js
Created September 3, 2021 14:44
read .csv with JS fetch()
const readCsv = async () => {
try {
//read .csv file on a server
const target = `https://SOME_DOMAIN.com/data/csv/[FILENAME].csv`;
//target can also be api with req.query
//get csv-structure-response from a server
//const target = `https://SOME_DOMAIN.com/api/data/log_csv?[QUERY]`;
const res = await fetch(target, {
@orpheousff8
orpheousff8 / responseCsv.js
Last active September 3, 2021 15:19
Node server response in CSV format
const { Parser } = require('json2csv')
//example database model (Modeling MongoDB with Mongoose)
const Log = require('../models/logModel')
const responseCsv = async (req, res) => {
let logs
try {
//reading logs from the database
//append .lean() to get a plain JS object rather than a mongoose document; use less memory