brew install zeromq leiningen zookeeper
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
#!/usr/bin/env python | |
# encoding: utf-8 | |
from time import sleep | |
import os | |
from billiard import freeze_support | |
freeze_support() | |
from celery.concurrency import prefork | |
from celery.concurrency.prefork import TaskPool |
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 asyncio | |
from msgpack import Unpacker, packb | |
class App(dict): | |
def make_handler(self): | |
return MsgpackProtocol(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
MultiPart.prototype.copy = function(writer, callback) { | |
var mp = this; | |
var parts = this.parts; | |
if(this.part != '') { parts.push(this.part); } | |
parts.push(CRLF + "--" + this.boundary + "--"); | |
parts.reverse(); | |
var BLOCKSIZE = 32*1024; | |
var readFile = function(fd, total, writer) { | |
var buffer = new Buffer(BLOCKSIZE); | |
fs.read(fd, buffer, 0, BLOCKSIZE, null, function(err, bytesRead) { |
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
require 'lib/worker.php'; | |
function getTitle($url) { | |
$html = file_get_contents("http://$url"); | |
if($html == FALSE) { | |
throw new Exception("can't fetch url"); | |
} | |
preg_match('/<title>(.*)<\/title>/i', $html, $matches); | |
return html_entity_decode($matches[1]); | |
} |
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
require 'eventmachine' | |
class NFuture | |
include EM::Deferrable | |
def initialize(times, &block) | |
@times = times | |
self.callback(&block) | |
end | |
def one_more_time(*arg) |
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
require "em-http-request" | |
require "em-synchrony" | |
class Weather | |
include EventMachine::Deferrable | |
attr_reader :code, :date, :temp, :humidity, :wind_speed | |
def _feed code, raw | |
rough = raw.split('#') | |
@code = code |
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
#encoding: utf-8 | |
require 'rubygems' | |
require 'tire' | |
# | |
# Playing with analyzers and its parameters. | |
# Witch fits best for the french language? | |
# | |
# $ rvm use 1.9.2 | |
# $ gem install tire |
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
#encoding: utf-8 | |
require 'rubygems' | |
require 'tire' | |
require 'json' | |
require 'active_support/core_ext/object/to_query' | |
require 'active_support/core_ext/object/to_param' | |
conf = { | |
settings: { | |
number_of_shards: 1, |
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
#encoding: utf-8 | |
require 'rubygems' | |
require 'tire' | |
require 'json' | |
require 'active_support/core_ext/object/to_query' | |
require 'active_support/core_ext/object/to_param' | |
Tire.configure { logger 'elasticsearch.log', :level => 'debug' } | |
Tire.index 'ponctu' do |