Skip to content

Instantly share code, notes, and snippets.

View arruda's full-sized avatar

Felipe Arruda Pontes arruda

View GitHub Profile

Keybase proof

I hereby claim:

  • I am arruda on github.
  • I am felipearruda (https://keybase.io/felipearruda) on keybase.
  • I have a public key whose fingerprint is 3254 CD16 FC1F 3F85 5FC8 05A9 A17A E420 0913 706D

To claim this, I am signing this object:

@arruda
arruda / broker.sh
Created April 9, 2012 13:45
Django-Celery In Daemon
sudo apt-get install rabbitmq-server
@arruda
arruda / relax.js
Created March 30, 2018 14:50 — forked from TheNicholasNick/relax.js
CouchDB Map/Reduce Example
// Data
[
{"_id":"pvg:IHC09A","_rev":"1-3881006720","nvic":"IHC09A","family":"159","couchrest-type":"GRD::Pvg","make":"ALFA ROMEO"},
{"_id":"pvg:IJU09A","_rev":"1-243536901","nvic":"IJU09A","family":"147","couchrest-type":"GRD::Pvg","make":"ALFA ROMEO"},
{"_id":"pvg:IJV09A","_rev":"1-3794903136","nvic":"IJV09A","family":"147","couchrest-type":"GRD::Pvg","make":"ALFA ROMEO"},
{"_id":"pvg:IJY09A","_rev":"1-1301614913","nvic":"IJY09A","family":"147","couchrest-type":"GRD::Pvg","make":"ALFA ROMEO"},
{"_id":"pvg:J3X09A","_rev":"1-1398113861","nvic":"J3X09A","family":"V8","couchrest-type":"GRD::Pvg","make":"ASTON MARTIN"}
]
// Map
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/home/lanchinho/blablabla/tutorial/db.sqlite' ,
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
@arruda
arruda / helloworld.rst
Created May 14, 2013 16:50
Hovercraft! Examples.
title

Hello World!

This is a simple Hello world example for hovercraft!


This is the First Slide:

Some text here in this slide...

@arruda
arruda / test_com_request_context.py
Created March 26, 2013 18:24
Usar RequestContext no Lugar de Context em testes onde for necessário renderizar um template manualmente. Se não usar o RequestContext ele ignora alguns, senão todos os TEMPLATE_CONTEXT_PROCESSORS, e não renderiza como deveria ou dependendo da template em questão, ele nem roda...
# -*- coding: utf-8 -*-
from lxml import html as lhtml
from django.template import Context, Template, RequestContext
from django.test import RequestFactory
factory = RequestFactory()
class TestTemplate(AlgumTestCase):
django-admin.py startproject --template=https://github.com/githubuser/dj_project_templates/blob/master/project_template.tar --extension="md,py" myproject
@arruda
arruda / awk_primo.awk
Created December 6, 2012 21:45
AOU exercicio awk
{num=$1
for (div = 2; div*div <= num; div++)
if (num % div == 0)
break
if (num % div == 0)
printf "%d nao eh primo\n", num
else
printf "%d eh primo\n",num}
@arruda
arruda / simple_awk.sh
Created December 6, 2012 21:15
AOU aula 2
grep labccet /etc/passwd | awk -F: '{print $7}'
@arruda
arruda / polls_tags.py
Created December 6, 2012 00:28
Django – Simple Template Tag Without a String as Argument
#-*- coding:utf-8 -*-
from django import template
register = template.Library()
from polls.models import Poll
@register.simple_tag(takes_context=True)
def get_userInfo_for_poll(context,poll, user):
context['userInfo'] = poll.getUserInfo(user)
return ''