socat -d -d TCP4-LISTEN:15432,fork UNIX-CONNECT:/srv/mongodb-27017.sock./forward-port-to-socket.sh 15432 /srv/mongodb-27017.sock| var nodemailer = require('nodemailer'), | |
| env = require('../env'); | |
| var Service = module.exports = function () {}; | |
| Service.prototype.sendByCurrentUserEmailAccount = function(opt, user) { | |
| var smtpTransport = nodemailer.createTransport('SMTP', { | |
| service: 'Gmail', | |
| auth: { | |
| XOAuth2: { |
| // before | |
| { 'content[title]': 'test', | |
| 'content[excerpt]': 'test', | |
| 'content[content]': 'test', | |
| 'content[featuredImage][title]': 'test', | |
| 'content[source][title]': 'test', | |
| 'content[source][url]': 'http://google.com', | |
| 'content[source][author]': 'test', | |
| 'content[source][publishedAt]': '25/07/2014', | |
| 'content[topics]': '539f11bcfdf15258000d9922' } |
| for code in {0..255}; do echo -e "\e[38;05;${code}m $code: Test"; done |
| mongoexport --collection collectioname --db databasename --out /tmp/output | |
| mongoimport --collection collectioname --db databasename --file /tmp/list-to-import.json --jsonArray --stopOnError |
| # remove all trash images | |
| docker rmi $(docker images | grep "^<none>" | awk '{print $3}') | |
| # or | |
| docker rmi $(docker images -q -f dangling=true) | |
| # stop all projects by name | |
| docker stop $(docker ps | grep "container_name" | awk '{print $1}') | |
| # get public port by private port and container name | |
| docker port container_name_or_id 27017 | awk -F':' '{print $2}' |
| #!/usr/bin/env node | |
| var MongoClient = require('mongodb').MongoClient, | |
| format = require('util').format, | |
| async = require('async'); | |
| MongoClient.connect('mongodb://127.0.0.1:27017/test_mongo', function(err, db) { | |
| if(err) throw err; | |
| var collection = db.collection('test_insert'); |
| # inline | |
| [ -d "my_dir" ] && echo "Yes" || echo "No" | |
| [ -f "my_file" ] && echo "Yes" || echo "No" | |
| # function | |
| dir_exists() { | |
| ( test -d $1 > /dev/null 2>&1 ) && return 0 || return 1 | |
| } | |
| file_exists() { |
| # for <= ubuntu 12.04 | |
| sudo apt-get install python-software-properties | |
| # for >= ubuntu 12.10 | |
| sudo apt-get install software-properties-common | |
| sudo add-apt-repository ppa:nginx/stable | |
| sudo apt-get update |
| function Produto(nome, qtd){ | |
| var self = this; | |
| self.Nome = nome || ''; | |
| self.Qtd = qtd || 0; | |
| return self; | |
| } | |
| var arroz = new Produto("Arroz", 10); |