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
"""Allow IO-synchronous (blocking) code run ``asynchronously'' in the | |
tornado IO loop. We accomplish this by using threads & a pipe to | |
notify the event loop when the synchronous call has finished. This | |
works because threads yield when waiting for IO. | |
``AsyncThreadPool'' also passes eventlogs around, so that they are | |
always set in the right thread context.""" | |
from __future__ import absolute_import | |
from __future__ import with_statement |
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
;; emacsd-tile.el -- tiling windows for emacs | |
(defun swap-with (dir) | |
(interactive) | |
(let ((other-window (windmove-find-other-window dir))) | |
(when other-window | |
(let* ((this-window (selected-window)) | |
(this-buffer (window-buffer this-window)) | |
(other-buffer (window-buffer other-window)) | |
(this-start (window-start this-window)) |
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
type ('a, 'b) t = Done | More of 'a * ('b -> ('a, 'b) t) | |
let gen f = | |
(* | |
* Note: the first value to yield gets thrown away as the generator | |
* has not yet started. | |
*) | |
let start _ = | |
let p = Delimcc.new_prompt () in | |
Delimcc.push_prompt p begin fun () -> |
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
#!/bin/sh | |
# $ sshm /fifo/directory host1 host2 host3... | |
# $ sshm -k /fifo/directory | |
# $ sshm /fifo/directory -c "ls" | |
# XXX - extra ssh flags | |
# set -- $(getopt kc "$@") |
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.util.concurrent.LinkedBlockingQueue | |
import java.util.concurrent.atomic.AtomicInteger | |
object Hotpotato { | |
private val nwaiters = new AtomicInteger(0) | |
private val executionQueue = new LinkedBlockingQueue[Function0[Unit]] | |
def serialized(f: => Unit) { | |
executionQueue offer { () => f } |
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
package com.twitter.test; | |
import java.net.InetSocketAddress; | |
import java.net.SocketAddress; | |
import java.util.concurrent.Executors; | |
import org.apache.thrift.TException; | |
import org.apache.thrift.protocol.TBinaryProtocol; | |
import com.twitter.finagle.*; |
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
(defvar git-grep-history '()) | |
(defvar git-grep-command "git grep -nH") | |
(defvar git-tree-command "git rev-parse --show-cdup") | |
;; from http://www.emacswiki.org/emacs/ElispCookbook | |
(defun chomp (str) | |
"Chomp leading and tailing whitespace from STR." | |
(let ((s (if (symbolp str) (symbol-name str) str))) | |
(replace-regexp-in-string "\\(^[[:space:]\n]*\\|[[:space:]\n]*$\\)" "" s))) |
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
trait LogicLike[A, This[A] <: LogicLike[A, This]] { | |
def or(t: => This[A]): This[A] | |
def map[B](f: A => B): This[B] | |
def flatMap[B](f: A => This[B]): This[B] | |
def filter(p: A => Boolean): This[A] | |
def split: Option[(A, This[A])] | |
def |(t: => This[A]): This[A] = or(t) | |
def run(n: Int): List[A] = | |
if (n <= 0) Nil else |
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
#!/bin/sh | |
exec runscala -dfinagle/finagle-core -dfinagle/finagle-ostrich4 -dfinagle/finagle-http "$0" "$@" | |
!# | |
import java.net.InetSocketAddress | |
import com.twitter.finagle._ | |
import com.twitter.finagle.builder._ | |
import com.twitter.finagle.http._ | |
import com.twitter.finagle.stats.OstrichStatsReceiver | |
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
diff --git a/finagle/finagle-core/src/main/scala/com/twitter/finagle/builder/ClientBuilder.scala b/finagle/finagle-core/src/main/scala/com/twitter/finagle/builder/ClientBuilder.scala | |
index 1df9c58..32663db 100644 | |
--- a/finagle/finagle-core/src/main/scala/com/twitter/finagle/builder/ClientBuilder.scala | |
+++ b/finagle/finagle-core/src/main/scala/com/twitter/finagle/builder/ClientBuilder.scala | |
@@ -56,7 +56,7 @@ import org.jboss.netty.channel.socket.nio._ | |
import org.jboss.netty.handler.ssl._ | |
import org.jboss.netty.handler.timeout.IdleStateHandler | |
-import com.twitter.util.{Future, Duration, Throw, Return} | |
+import com.twitter.util.{Future, Duration, Throw, Return, Monitor, NullMonitor} |
OlderNewer