This is a short resume about what I understood about the masterpiece GEB, from Douglas Hofstadter
"How do we get I's from None I's?"
import sqlalchemy | |
engine = sqlalchemy.create_engine('sqlite:///:memory:', echo=False) | |
from sqlalchemy.ext.declarative import declarative_base | |
from Crypto.Hash import SHA256 | |
from sqlalchemy.orm import relationship, backref | |
Base = declarative_base() | |
class User(Base): | |
I consider myself a medium-to-experienced Python programmer (I am using python for 6 years). Today I've lost almos one hour in a very stupid bug with lambda functions. See what happend:
I was building a very simple Tkinter GUI (I'm not an GUI expert, so I code in Tkinter because it is easy and simple, but I myself think that it is ugly).
Some of you shall ask yourselves: "How does a spirograph work?". But I'm sure that most of you would ask me: "What the wacko is an spirograph?"
An spirograph is a toy used to draw "weird spirals" using two circles (one inside other). For whom doesn't remember, the toy is these one:
The way that this toy works is simples: One gear spins inside a big circle (also with gears!). The pen is placed in a hole of the gear. When you spin the gear through the major circle, the pen follows tho different movements: An circle movement made by the gear around the center of the great circle (let's call this point as O) and a movement made by the pen around the center of the gear (let's call the center of the gear as C and the point where the pen is placed as P). As the center of the gear is moving, the result position of the point P is the sum of these two movements: P over C
Alguns de vocês devem se perguntar: "Como os espirógrafos funcionam?". Mas a maioria de vocês perguntaria antes "espiro-o-que??".
Bem, espirógrafo é aquele brinquedo que muitos de nós usamos quando pequenos para fazer umas "espirais malucas" desenhadas no papel. O brinquedo é esse aí:
A mecânica do brinquedo é bem simples: uma roda dentada gira dentro de um círculo (também dentado). Sua caneta, que está presa em um orifíco da roda dentada acompanha dois movimentos distintos que são somados: o movimento circular em torno do ponto central do grande cículo (vamos chamar este ponto de O) e um movimento circular em torno do centro da roda dentada (vamos chamar o centro da roda dentada de C). Este centro, por sua vez, está em movimento. É a soma destes dois movimentos que faz surgir aqueles "desenhos muito doidos de São Tomé".
Alguns de vocês devem se perguntar: "Como os espirógrafos funcionam?". Mas a maioria de vocês perguntaria antes "espiro-o-que??".
Bem, espirógrafo é aquele brinquedo que muitos de nós usamos quando pequenos para fazer umas "espirais malucas" desenhadas no papel. O brinquedo é esse aí:
from time import strftime | |
import Tkinter | |
numbers = {0:'midnight', | |
1:'one', | |
2:'two', | |
3:'three', | |
4:'four', |
#coding: utf-8 | |
""" | |
Conway's Game of Life implementation with console interface | |
Author: Antonio Ribeiro - alvesjunior.antonio@gmail.com | |
license: Do What You Want to | |
""" | |
from time import sleep | |
from random import randint |
root@d2b55f66d8dd:/srv/jupyterhub_config# cd /tmp/luceda-packages/ | |
root@d2b55f66d8dd:/tmp/luceda-packages# ls | |
ipkiss-311-packages-linux64 luceda_cst-0.1.2-py27_1.tar.bz2 | |
root@d2b55f66d8dd:/tmp/luceda-packages# . activate py2 | |
(py2) root@d2b55f66d8dd:/tmp/luceda-packages# conda install -n py2 luceda_cst-0.1.2-py27_1.tar.bz2 | |
(py2) root@d2b55f66d8dd:/tmp/luceda-packages# python | |
Python 2.7.12 | packaged by conda-forge | (default, Sep 8 2016, 14:22:31) | |
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from luceda_cst.model import CapheModelCST |
[D 2017-02-23 11:33:11.390 JupyterHub app:740] Generating new cookie_secret | |
[I 2017-02-23 11:33:11.390 JupyterHub app:745] Writing cookie_secret to /srv/jupyterhub_config/jupyterhub_cookie_secret | |
[D 2017-02-23 11:33:11.391 JupyterHub app:796] Connecting to db: sqlite:///jupyterhub.sqlite | |
[W 2017-02-23 11:33:12.361 JupyterHub app:365] | |
Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy. | |
Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message. | |
[D 2017-02-23 11:33:12.595 JupyterHub app:1085] Loading state for juno from db | |
[D 2017-02-23 11:33:12.596 JupyterHub dockerspawner:348] Getting container 'jupyter-juno' | |
[E 2017-02-23 11:33:12.667 JupyterHub app:1527] |