Skip to content

Instantly share code, notes, and snippets.

View alvesjnr's full-sized avatar

Antonio Ribeiro Alves alvesjnr

View GitHub Profile
@alvesjnr
alvesjnr / tree.py
Created February 21, 2012 10:30
List directories like a tree
# -*- coding: utf-8 -*-
import os
def get_files_tree(root, level=0, stack_on_level={}, show_hidden=False, output=[]):
if level==0:
print root
files = os.listdir(root)
from framework import simulator
if __name__=='__main__':
print 'oi'
class Autor(object):
def __set__(self, instancia, valor):
if len(valor.split()) < 2:
raise ValueError('Deve ser informado o nome e sobrenome')
for nome_atr, valor_atr in instancia.__class__.__dict__.items():
if valor_atr == self:
self.nome_atr = '__'+nome_atr
setattr(instancia, self.nome_atr, valor)
break

First of all I created two files:

File which contains the base class (I called it base.py)

class A(object):
   """do something"""
   def __init__(self):
       print 'initializing base class' 
       print '__module__: ', self.__module__ 

print 'class: ', self.class

@alvesjnr
alvesjnr / complex_vector.py
Created January 30, 2012 14:00
First example of complex vector
import math
import numpy
from matplotlib import pyplot
def get_Ft(complex_vector, w, t, dt):
time = numpy.arange(0,t,dt)
for t in time:
@alvesjnr
alvesjnr / GEB.md
Created November 28, 2011 16:49
Gödel, Escher, Bach

Lecture about the book Gödel Escher Bach

This is a short resume about what I understood about the masterpiece GEB, from Douglas Hofstadter

What is this book about?

"How do we get I's from None I's?"

DEBUG = False
SITE_ID = 2
ADMINS = (
('Webmaster Ensaios Clinicos', '[email protected]'),
)
DATABASES = {
'default' : {
# This file needs to set the variable 'application' to a WSGI handler of some
# description.
# +++++++++++ CUSTOM WSGI +++++++++++
# If you have a WSGI file that you want to serve using PythonAnywhere, perhaps
# in your home directory under version control, then use something like this:
#
import os
int a();
int main()
{
a();
}
class Schema(colander.Schema):
title = colander.SchemaNode(
colander.String(),
title='Book Title',
description='Book title without abbreviations',
)
schema = Schema()
form = deform.Form(schema)
form.render({'title':None}) # It is rendering a text field with the string None as content