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 "pp" | |
require "singleton" | |
class Multiton | |
include Singleton | |
class << Singleton | |
def __init__(klass) | |
klass.instance_eval { | |
@multiton__instances__ = {} |
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 ruby | |
require 'celluloid' | |
require 'weakref' | |
class Test | |
begin | |
include Celluloid | |
finalizer :shutdown | |
rescue |
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 'celluloid/zmq' | |
Celluloid::ZMQ.init | |
class Server | |
include Celluloid::ZMQ | |
def initialize(address) | |
@socket = RouterSocket.new | |
@socket.set ::ZMQ::SNDHWM, 0 |
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 'celluloid/zmq' | |
Celluloid::ZMQ.init | |
class Client | |
include Celluloid::ZMQ | |
def initialize(address) | |
@socket = DealerSocket.new | |
@socket.set ::ZMQ::SNDHWM, 0 |
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
class Visitor(ast.NodeVisitor): | |
def visit_Call(self, node): | |
if node.func.id == 'export': | |
if len(node.args) < 1: | |
raise Exception, 'Invalid number of argumets to export at line %d' % node.lineno | |
doc = '' | |
for kw in node.keywords: | |
if kw.arg == 'doc': | |
doc = kw.value | |
if isinstance(kw.value, ast.Str): |
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 ruby | |
require 'celluloid' | |
require 'weakref' | |
class Bar | |
attr_reader :bar | |
def initialize(bar) | |
@bar = bar |
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 ruby | |
require 'weakref' | |
foo = 'toto' | |
weak = WeakRef.new foo | |
f = Fiber.new do | |
p foo | |
# if fiber yield is not called the fiber context is never released |
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 ruby | |
require 'weakref' | |
class Proxy < BasicObject | |
attr_reader :cls | |
def initialize(cls) | |
@cls = cls | |
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
#!/usr/bin/env ruby | |
require 'weakref' | |
$LEAK = true | |
class Hidden | |
def initialize(cls) | |
@cls = cls | |
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
#include <stdio.h> | |
#include <inttypes.h> | |
#include <stdbool.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/time.h> | |
#include <assert.h> | |
#include <getopt.h> |
OlderNewer