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
# 1. discover what is wrong | |
sudo nginx -t | |
# 2. fix everything | |
# 3. restart the service | |
sudo service nginx restart |
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 Produto(nome, qtd){ | |
var self = this; | |
self.Nome = nome || ''; | |
self.Qtd = qtd || 0; | |
return self; | |
} | |
var arroz = new Produto("Arroz", 10); |
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
vagrant@srv:/srv/my-project$ npm install | |
npm http GET https://registry.npmjs.org/factory-mysql-fixtures | |
npm http 304 https://registry.npmjs.org/factory-mysql-fixtures | |
npm ERR! notarget No compatible version found: factory-mysql-fixtures@'maxcnunes/factory-mysql-fixtures' | |
npm ERR! notarget Valid install targets: | |
npm ERR! notarget ["0.0.2"] | |
npm ERR! notarget | |
npm ERR! notarget This is most likely not a problem with npm itself. | |
npm ERR! notarget In most cases you or one of your dependencies are requesting | |
npm ERR! notarget a package version that doesn't exist. |
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
FROM ubuntu | |
MAINTAINER Max Claus Nunes | |
RUN apt-get install -y python-software-properties python | |
RUN add-apt-repository ppa:chris-lea/node.js | |
RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise universe" >> /etc/apt/sources.list | |
RUN apt-get update | |
RUN apt-get install -y nodejs | |
#RUN apt-get install -y nodejs=0.6.12~dfsg1-1ubuntu1 | |
RUN mkdir /var/www |
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
# 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 |
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
# 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() { |
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
#!/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'); |
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
# 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}' |
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
mongoexport --collection collectioname --db databasename --out /tmp/output | |
mongoimport --collection collectioname --db databasename --file /tmp/list-to-import.json --jsonArray --stopOnError |
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
for code in {0..255}; do echo -e "\e[38;05;${code}m $code: Test"; done |
OlderNewer