This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyaio | |
import time | |
def aio_callback(buf): | |
print 'python callback %s' % buf | |
#file name, offset, lenght, callback function | |
pyaio.aio_read('/tmp/b.txt', 10, 20, aio_callback) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static PyObject * | |
pyaio_write(PyObject *dummy, PyObject *args) { | |
const char *filename; | |
const char *buffer; | |
struct aiocb cb; | |
int ret, offset, numbytes; | |
Pyaio_cb *aio; | |
PyObject *result = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original WSGI application. | |
def application(environ, start_response): | |
... | |
# Logging WSGI middleware. | |
import pprint | |
class LoggingMiddleware: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zmq | |
import threading | |
import time | |
from random import choice | |
class ClientTask(threading.Thread): | |
"""ClientTask""" | |
def __init__(self): | |
threading.Thread.__init__ (self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if you're on linux host, you need xvfb | |
sudo apt-get install xvfb | |
git clone git://github.com/felipecruz/jasmine-gem.git | |
cd jasmine-gem | |
git submodule init | |
git submodule update | |
gem install rails | |
gem install gem-release | |
gem install bundler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jasmine | |
class Config | |
# Add your overrides or custom config code here | |
def jasmine_xvfb | |
'xvfb-run --server-args="-screen 0 2000x1400x24"' | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rake jasmine:phantomjsci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
distolica = new ValueAnswer("Distolica"); | |
sistolica = new ValueAnswer("Sistolica"); | |
complex_rule = new ComplexRule( { distolica: distolica, sistolica: sistolica}, | |
"context.Distolica > 14 && context.Sistolica > 8", | |
null, | |
function() { recomendations.push("Hipertensao! Marcar consulta"); }); | |
complex_rule2 = new ComplexRule( { distolica: distolica, sistolica: sistolica}, | |
"context.Distolica < 10 && context.Sistolica < 8", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Domicilio | |
q = new DataQuestion("Registro da Família"); | |
q2 = new DataQuestion("Familia"); | |
q3 = new DataQuestion("Endereco"); | |
q4 = new DataQuestion("Numero"); | |
q5 = new DataQuestion("Complemento"); | |
q6 = new DataQuestion("Procedencia"); | |
q7 = new DataQuestion("Tempo de Moraria"); | |
q8 = new DataQuestion("Bairro"); | |
q9 = new DataQuestion("CEP"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ctypes import * | |
from ctypes.util import find_library | |
czmq = CDLL(find_library("czmq"),use_errno=True) | |
czmq.zctx_new.restype = c_void_p | |
czmq.zctx_new.argtypes = [] | |
context = czmq.zctx_new() | |
czmq.zctx__socket_new.restype = c_void_p | |
czmq.zctx__socket_new.argtypes = [c_void_p,c_int] | |
socket = czmq.zctx__socket_new(context, c_int(3)) |
OlderNewer