Skip to content

Instantly share code, notes, and snippets.

View maxcnunes's full-sized avatar
🏠
Working from home forever and ever

Max Claus Nunes maxcnunes

🏠
Working from home forever and ever
View GitHub Profile
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
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.
function Produto(nome, qtd){
var self = this;
self.Nome = nome || '';
self.Qtd = qtd || 0;
return self;
}
var arroz = new Produto("Arroz", 10);
@maxcnunes
maxcnunes / inspect-nginx.sh
Created February 2, 2014 02:55
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
@maxcnunes
maxcnunes / create-multiple-directories-in-a-path.sh
Created January 20, 2014 14:48
Create multiple directories in a path
mkdir -p site-cookbooks/tomatoes/{recipes,{templates,files}/default}
@maxcnunes
maxcnunes / find-out-what-process-using-a-specific-port.sh
Created January 16, 2014 18:39
Unix - Find what process is using a specif port
# with netstat
netstat -nlp | grep :80
# or with lsof
lsof -i :80 | grep LISTEN
# http://www.cyberciti.biz/faq/find-linux-what-running-on-port-80-command/
@maxcnunes
maxcnunes / setting-up-ssh-unix.sh
Created January 16, 2014 10:23
Setting up SSH key authentication on Unix
# generate ssh key
ssh-keygen -t dsa
# (Don’t enter a passphrase unless you want to type it every time you want to use the key)
# set permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_dsa
chmod 644 ~/.ssh/id_dsa.pub
# Add this to you ~/.profile
function tree {
find ${1:-.} -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
}
# Then:
$ source ~/.profile
$ tree
@maxcnunes
maxcnunes / example.js
Created December 24, 2013 12:55
Wait mongo connection before test express controller/route with supertest
var request = require('supertest'),
mongoose = require('mongoose'),
app = require('../../../../server');
describe('GET /api/transactions/import', function(){
before(function (done) {
mongoose.connection.on('open', done);
});
it('respond with json', function(done){
@maxcnunes
maxcnunes / Ask_Version.cs
Last active December 31, 2015 15:19
Example of Principle Tell don't Ask
private class Screen
{
Form mainForm = ...
private void Screen_Loaded(object sender, ControlLoadedEventArgs e)
{
if(mainForm.InputControls != null && mainForm.InputControls.Contains("Id"))
mainForm.InputControls["Id"].Editable = isEditable;
}
}