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 java.net.InetSocketAddress; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import org.jboss.netty.bootstrap.ServerBootstrap; | |
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; | |
import org.jboss.netty.channel.*; | |
import static org.jboss.netty.channel.Channels.pipeline; | |
import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; | |
import org.jboss.netty.handler.execution.ExecutionHandler; |
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 java.net.InetSocketAddress; | |
import java.util.concurrent.Executors; | |
import java.util.HashMap; | |
import java.util.Map; | |
import org.jboss.netty.bootstrap.ServerBootstrap; | |
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory; | |
import org.jboss.netty.channel.*; | |
import static org.jboss.netty.channel.Channels.pipeline; | |
import org.jboss.netty.handler.codec.http.*; |
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 java.net.InetSocketAddress; | |
import java.net.URI; | |
import java.util.concurrent.Executors; | |
import org.jboss.netty.bootstrap.ClientBootstrap; | |
import org.jboss.netty.channel.ChannelFactory; | |
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory; | |
import org.jboss.netty.handler.codec.http.DefaultHttpRequest; | |
import org.jboss.netty.handler.codec.http.HttpHeaders; | |
import org.jboss.netty.handler.codec.http.HttpMethod; |
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
# A simple script to test memory allocation/deallocation in Python | |
# | |
# When run under Win32 with Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) | |
# [MSC v.1500 32 bit (Intel)] | |
# it will after each allocation release all memory back the OS. | |
# | |
# However, when run under Linux/RHEL5 with | |
# Python 2.6 (r26:66714, Jun 15 2009, 17:33:43) | |
# [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] | |
# it never releases the memory again, thus eating more and more memory. |
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 time | |
time.sleep(123) |
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 locust | |
import gevent | |
from clients import HTTPClient | |
from gevent import wsgi | |
# Defines the behaviour of a locust (aka a website user :) | |
def website_user(name): | |
c = HTTPClient('http://localhost:8088') | |
for i in range(0, 10): | |
c.get('/fast', name='Fast page') # Request the fast page |
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
/** | |
* Small patch by Carl Byström to make the readLine non-greedy. | |
* | |
* The MIT License | |
* | |
* Copyright (c) 2009 Adam MacBeth | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights |
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
public function generateUri(protocol:String = "ws"):String { | |
var uri:String = protocol + "://" + host + "/spheres/" + apiKey + "/users/" + user; | |
var params:Array = ['authToken=t']; | |
if (sequenceId > 0) { params.push("sequenceId=" + sequenceId); } | |
if (channels && channels.length > 0) { params.push("channels=" + channels.join(',')); } | |
if (params.length > 0) { | |
uri += "?"; | |
uri += params.join('&'); | |
} |
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
Ludwig Bell - Silvertejp | |
http://open.spotify.com/track/1yuUvo5DA0QqmKGPPpZlFF | |
Capo 5 | |
(Ackord relativt capo) | |
F/C x33210 | |
C x32013 | |
G 11 32301x | |
G 320013 |
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
/* | |
node.js vs Python with Greenlets (say gevent) | |
I don't get why node.js is being so hyped. | |
Sure, the idea of writing things in JavaScript both on the client and server-side is really nice. | |
And JavaScript really fit an event-driven environment with its browser heritage. | |
But why on earth is boomerang code so appealing to write? I don't get. Am I missing something obvious? | |
All examples of node.js I see are littered with callbacks yet Ryan Dahl thinks coroutines suck. It doesn't add up for me. |
OlderNewer