Skip to content

Instantly share code, notes, and snippets.

View ManotLuijiu's full-sized avatar
🏠
Working from home

Manot Luijiu ManotLuijiu

🏠
Working from home
View GitHub Profile
@ManotLuijiu
ManotLuijiu / redis11000.conf
Last active August 13, 2021 06:55
Redis port 11000 configuration for ERPNext
# /usr/local/etc/redis11000.conf
# Redis port 11000 configuration for ERPNext
bind 127.0.0.1 ::1
protected-mode yes
port 11000
tcp-backlog 511
@ManotLuijiu
ManotLuijiu / nanorc
Created August 11, 2021 08:03
nanorc manual
NANORC(5) 2021" NANORC(5)
NAME
nanorc - GNU nano's configuration file
DESCRIPTION
The nanorc files contain the default settings for nano, a small and friendly editor. During startup,
@ManotLuijiu
ManotLuijiu / homebrew.mxcl.redis13000.plist
Created August 9, 2021 13:54
Configuration Redis Port 13000 for ERPNext
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.redis13000</string>
<key>ProgramArguments</key>
<array>
@ManotLuijiu
ManotLuijiu / homebrew.mxcl.redis12000.plist
Created August 9, 2021 13:53
Configuration Redis Port 12000 for ERPNext
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.redis12000</string>
<key>ProgramArguments</key>
<array>
@ManotLuijiu
ManotLuijiu / homebrew.mxcl.redis11000.plist
Last active August 9, 2021 17:10
Configure Redis Port 11000 for ERPNext
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>homebrew.mxcl.redis11000</string>
<key>ProgramArguments</key>
<array>
@ManotLuijiu
ManotLuijiu / .nanorc
Created August 7, 2021 15:57
nano colorize configuration
set tabsize 4
set tabstospaces
set autoindent
set trimblanks
set linenumbers
set constantshow
set titlecolor white,red
set keycolor cyan
set functioncolor cyan
set numbercolor yellow
@ManotLuijiu
ManotLuijiu / error.js
Created June 17, 2021 06:28
Error handler for NodeJS Project
const ErrorResponse = require('./errorResponse');
const logger = require('./logger');
const colors = require('colors');
colors.enable();
const errorHandler = (err, req, res, next) => {
let error = { ...err };
error.message = err.message;
// logger.error(err.stack.red);
console.log(err.stack.red);
@ManotLuijiu
ManotLuijiu / errorResponse.js
Created June 16, 2021 16:09
ES6 Custom Error Class
class ErrorResponse extends Error {
constructor(message, statusCode, reason) {
super(message);
this.statusCode = statusCode;
this.reason = reason;
this.name = 'ErrorResponse';
}
}
module.exports = ErrorResponse;
@ManotLuijiu
ManotLuijiu / .env.example
Created June 7, 2021 17:58
How to put MongoDB URI in .env file
MONGO_URI='mongodb+srv://<user>:<password>@<cluster_name>.xxxxx.mongodb.net/<database_name>?retryWrites=true&w=majority'
@ManotLuijiu
ManotLuijiu / logger.js
Last active August 3, 2025 17:28
Print filename and line-number to node's log with winston and morgan
const winston = require('winston');
require('winston-daily-rotate-file');
require('winston-mongodb');
const path = require('path');
const PROJECT_ROOT = path.join(__dirname, '..');
const highlight = require('cli-highlight').highlight;
const arrow = '\u276F\u276F\u25B6';
const logConfig = {