This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mongod --port 27017 --dbpath /var/lib/mongo --replSet rs0 | |
# sudo service mongod start | |
# nano /etc/mongod.conf | |
mongod --port 27017 --dbpath /data/db/rs0 --replSet rs0 | |
mongod --port 27018 --dbpath /data/db/rs1 --replSet rs0 | |
mongod --port 27019 --dbpath /data/db/rs2 --replSet rs0 | |
rsconf = { | |
_id: "rs0", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "", | |
"version": "0.0.0", | |
"dependencies": { | |
"async": "^2.1.4", | |
"body-parser": "^1.16.1", | |
"cookie-session": "^1.2.0", | |
"crossdomain": "0.0.1", | |
"dateformat": "^2.0.0", | |
"express": "^4.14.1", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chown -R ec2-user /var/www/html | |
chmod -R 755 /var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.env.NODE_ENV = 'test'; | |
let chai = require('chai'); | |
let chaiHttp = require('chai-http'); | |
let server = require('../app'); | |
let should = chai.should(); | |
chai.use(chaiHttp); | |
describe('Server', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var helmet = require('helmet'); | |
app.use(helmet()); | |
var morgan = require('morgan'); | |
var fs = require('fs'); | |
var FileStreamRotator = require('file-stream-rotator') | |
var logDirectory = __dirname + '/logs' | |
fs.existsSync(logDirectory) || fs.mkdirSync(logDirectory); | |
var accessLogStream = FileStreamRotator.getStream({ | |
date_format: 'YYYYMMDD', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use admin | |
db.createUser( | |
{ | |
user: "", | |
pwd: "", | |
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] | |
} | |
) | |
mongo --port 27017 -u "" -p "" --authenticationDatabase "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo service mongod stop | |
sudo yum erase $(rpm -qa | grep mongodb-org) | |
sudo rm -r /var/log/mongodb | |
sudo rm -r /var/lib/mongo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nodemailer = require('nodemailer'); | |
var ses = require('nodemailer-ses-transport'); | |
var transporter = nodemailer.createTransport(ses({ | |
accessKeyId: '', | |
secretAccessKey: '', | |
region: 'us-west-2' | |
})); | |
var mailOptions = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function postAjax(url, data, success) { | |
var params = typeof data == 'string' ? data : Object.keys(data).map( | |
function(k){ return encodeURIComponent(k) + '=' + encodeURIComponent(data[k]) } | |
).join('&'); | |
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); | |
xhr.open('POST', url); | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState>3 && xhr.status==200) { success(xhr.responseText); } | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector("body").style.WebkitFilter = 'blur(4px)'; | |
document.querySelector("body").style.filter= 'blur(4px)'; |