Skip to content

Instantly share code, notes, and snippets.

View vanduc1102's full-sized avatar
πŸ›
πŸ’― πŸ’― πŸ’© πŸ˜† 🐒

Duke Nguyen vanduc1102

πŸ›
πŸ’― πŸ’― πŸ’© πŸ˜† 🐒
View GitHub Profile
@vanduc1102
vanduc1102 / deploy-reactjs-gcloud-storage.sh
Last active April 29, 2019 06:04
Deploy ReactJS application on Google Cloud Storage with Google Cloud Build
#!/bin/bash
BUCKET_NAME=staging.acb.com
BUCKET_PATH="gs://${BUCKET_NAME}"
gsutil mb -l asia-east2 $BUCKET_PATH
gsutil iam ch allUsers:objectViewer $BUCKET_PATH
gsutil web set -m index.html -e index.html $BUCKET_PATH
@vanduc1102
vanduc1102 / .vimrc
Last active March 13, 2019 07:15
VIM show hidden characters
syntax on
set number
set list
set listchars=tab:β†’\ ,space:Β·,nbsp:␣,trail:β€’,eol:ΒΆ,precedes:Β«,extends:Β»
@vanduc1102
vanduc1102 / nodejs-mongodb-redis.yml
Created March 2, 2019 08:38
Nodejs MongoDB Redis Yamal
version: '3'
services:
api:
build: .
restart: always
command: npm start
volumes:
- '.:/usr/src/app'
- /usr/src/app/node_modules/ # --ingore node_modules folder
ports:
@vanduc1102
vanduc1102 / cloudSettings
Last active June 1, 2019 17:43
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-06-01T17:43:02.604Z","extensionVersion":"v3.2.9"}
@vanduc1102
vanduc1102 / docker-compose.yml
Created February 11, 2019 01:26
Docker compose Redis MongoDB example
version: '3'
services:
mongodb:
image: mongo:3.6-stretch
container_name: "mongodb"
environment:
- MONGO_DATA_DIR=/data/db
- MONGO_LOG_DIR=/dev/null
volumes:
- ~/.docker-volumes/lime-be/mongodb/data/db:/data/db
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
@vanduc1102
vanduc1102 / logger.js
Last active May 28, 2021 07:54
Here is my logger.js with winston": "^3.1.0
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, printf, colorize, splat } = format;
const myFormat = printf((info) => {
if (info.meta && info.meta instanceof Error) {
return `${info.timestamp} ${info.level} ${info.message} : ${info.meta.stack}`;
}else if(info.stack){
return `${info.timestamp} ${info.level} ${info.message} : ${info.stack}`;
}
return `${info.timestamp} ${info.level}: ${info.message}`;
###############################################
## overrides deployment configuration mode value
## use command bin/magento deploy:mode:set to switch modes
# SetEnv MAGE_MODE developer
############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi
# To to active profile you need to add the environment variable
mvn spring-boot:run -Dspring.profiles.active=production
# Or add a parameter to start application command
java -jar target/your_packaged.jar -Dspring.profiles.active=production
@SpringBootApplication
@EnablePrometheusEndpoint
public class Application {
private static final String BOOTSTRAP_PATH =
"/data/project/project-code/config/bootstrap.yml";
public static void main(String[] args) {
loadBootstrapConfiguration();
SpringApplication.run(Application.class, args);
}