Skip to content

Instantly share code, notes, and snippets.

View alvesjnr's full-sized avatar

Antonio Ribeiro Alves alvesjnr

View GitHub Profile
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]
(import [random [shuffle]])
(defn quick [s]
(if (len s)
(+ (quick (list-comp x [x s] (< x (first s)) ))
[(first s)]
(quick (list-comp x [x s] (> x (first s)) ))
)
[]
)
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@alvesjnr
alvesjnr / blah.py
Last active December 26, 2015 04:59
# using python 2.7
class A(object):
value = 10
class B(A):
other_value = 11
def _get_pythonpath(self):
if os.name == 'nt':
p = subprocess.Popen(["set",], shell=True, stdout=subprocess.PIPE)
out, err = p.communicate()
for line in out.split():
if line.startswith("PYTHONPATH"):
return line.split()[1]
else:
p = subprocess.Popen(["echo", "$PYTHONPATH"], shell=True, stdout=subprocess.PIPE)
out, err = p.communicate()
try:
#py 2.x
from Tkinter import *
except ImportError:
#py 3.x
from tkinter import *
app = Tk()
@alvesjnr
alvesjnr / a_text.rst
Last active November 10, 2023 01:14
I got trapped by a lambda function.

I got trapped by a lambda function

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:

Tkinter, Buttons and Callbacks

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).

@alvesjnr
alvesjnr / gol.py
Created February 20, 2013 10:30
Yesterday I was showing my wife how does a computer program works, so I end up with this code
#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
@alvesjnr
alvesjnr / trie.py
Created January 31, 2013 16:56
Naive Trie implementation
class Node(dict):
def __init__(self, value=None, *args, **kwargs):
self.value = value
super(Node,self).__init__(*args, **kwargs)
class Trie(object):