Skip to content

Instantly share code, notes, and snippets.

Working from home forever and ever

Max Claus Nunes maxcnunes

Working from home forever and ever
Block or report user

Report or block maxcnunes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
maxcnunes /
Created Feb 2, 2014
Nginx not running with no error message
# 1. discover what is wrong
sudo nginx -t
# 2. fix everything
# 3. restart the service
sudo service nginx restart
View class_and_array.js
function Produto(nome, qtd){
var self = this;
self.Nome = nome || '';
self.Qtd = qtd || 0;
return self;
var arroz = new Produto("Arroz", 10);
vagrant@srv:/srv/my-project$ npm install
npm http GET
npm http 304
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.
View Dockerfile
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 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
maxcnunes /
Last active Aug 29, 2015
install nginx stable version on ubuntu 13.10
# 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
# 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() {
View loop-insert-mongo.js
#!/usr/bin/env node
var MongoClient = require('mongodb').MongoClient,
format = require('util').format,
async = require('async');
MongoClient.connect('mongodb://', function(err, db) {
if(err) throw err;
var collection = db.collection('test_insert');
# 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}'
View mongo-import-export
mongoexport --collection collectioname --db databasename --out /tmp/output
mongoimport --collection collectioname --db databasename --file /tmp/list-to-import.json --jsonArray --stopOnError
for code in {0..255}; do echo -e "\e[38;05;${code}m $code: Test"; done
You can’t perform that action at this time.