Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# coroutine equivalent of http://play.golang.org/p/lKBbS56f-n
def generate(s,even,odd):
for i,c in enumerate(s):
if i%2 == 0:
even.send(c)
else:
odd.send(c)
@elazarl
elazarl / redcon.go
Created June 6, 2011 08:45
redirect network stream
package main
import (
"log"
"io"
"os"
"crypto/tls"
"strings"
"net"
"flag"
@elazarl
elazarl / BlockReadWriter.go
Created May 30, 2011 13:57
golang - A blocking reader
package main
import (
"fmt"
"bytes"
"os"
"log"
"time"
"io"
"http"