Skip to content

Instantly share code, notes, and snippets.

View elyssonmr's full-sized avatar
🤘

Élysson MR elyssonmr

🤘
View GitHub Profile
@elyssonmr
elyssonmr / gist:6689242
Last active December 23, 2015 20:19
Comparador de "Googlon" do Curso Python para Zumbis. OBS: Código para Python3
class GooglonComparador:
def __init__(self, obj, *args):
self.obj = obj
self.ordem_dict = {}
for i, letra in enumerate('zmbtshjpnwlrcxkqvdgf'):
self.ordem_dict[letra] = i
# Menor que = Less than
def __lt__(self, other):
return self._comparar(self.obj, other.obj) < 0
# Maior que = Greater than
@elyssonmr
elyssonmr / Tsuru.conf
Created January 22, 2015 16:25
Tsuru.conf
listen: "0.0.0.0:8080"
host: http://10.0.2.15:8080
debug: true
admin-team: admin
database:
url: 127.0.0.1:27017
name: tsurudb
git:
@elyssonmr
elyssonmr / log
Created January 22, 2015 17:08
last log entry
Opening config file: /etc/tsuru/tsuru.conf
Done reading config file: /etc/tsuru/tsuru.conf
Using mongodb database "tsurudb" from the server "127.0.0.1:27017".
Using hipache router "10.0.2.15.nip.io" with redis at "localhost:6379".
Using "docker" provisioner.
Cluster Storage: Unable to connect to mongodb: no reachable servers (docker:cluster:mongo-url = "127.0.0.1:27017"; docker:cluster:mongo-database = "dockercluster")
Thu Jan 22 17:36:17.869 [initandlisten] MongoDB starting : pid=1098 port=27017 dbpath=/var/lib/mongodb 64-bit host=vagrant-ubuntu-trusty-64
Thu Jan 22 17:36:17.869 [initandlisten] db version v2.4.9
Thu Jan 22 17:36:17.869 [initandlisten] git version: nogitversion
Thu Jan 22 17:36:17.869 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54
Thu Jan 22 17:36:17.870 [initandlisten] allocator: tcmalloc
Thu Jan 22 17:36:17.870 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log", nojournal: "true" }
Thu Jan 22 17:36:17.892 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /var/lib/mongodb/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Thu Jan 22 17:36:17.892 dbexit:
Thu Jan 22 17:36:17.892 [initandlisten] shutdown: going to close listening sockets...
Thu J
@elyssonmr
elyssonmr / gist:e0a449e021ec1a4b4268
Created February 6, 2015 23:41
matriz_test.py
from unittest import TestCase
from mock import patch, Mock
from matriz import Matriz
class MatrizTest(TestCase):
@patch('matriz.Matriz.inicializar_matriz')
def test_intancia_matriz(self, method):
method.return_value = 'matriz'
import sys
from django.conf import settings
settings.configure( # configure
DEBUG=True,
SECRET_KEY='thisisthesecretkey',
ROOT_URLCONF=__name__,
MIDDLEWARE_CLASSES=(
@elyssonmr
elyssonmr / NodeExample.js
Created November 12, 2015 13:52
Gist de node
a = 2
function incrementar () {
for (b = 1; b < 100000000; b++) {
b += b
}
a += 1 // valores são passados por cópia e não referência
}
incrementar()
@elyssonmr
elyssonmr / provision.sh
Created November 8, 2016 02:53
My Vagrant's provision script to run Python3 on Ubuntu images
#!/usr/bin/env bash
# System Update
apt-get update
# Pre requisites Packages
apt-get install -y build-essential
apt-get install -y git
# Development Packages
apt-get install -y python3
import urllib
from StringIO import StringIO
from django import forms
from django.core.files import File
from formexemplo.models import Pessoa
class PessoaModelForm(forms.ModelForm):
@elyssonmr
elyssonmr / exercicio1
Created July 20, 2017 00:16
Exercício1
const produtos = [
{
nome: 'Bicicleta',
preco: 1200.0
},
{
nome: 'Capacete',
preco: 450.0
}
]