This file contains hidden or 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
struct LeveeMiddle { | |
struct LeveeEnd* ends[2]; | |
} | |
struct LeveeEnd { | |
struct LeveeMiddle middle; | |
} |
This file contains hidden or 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
local ev = require("ev") | |
ev.run(function(h) | |
function echo(conn) | |
for message in conn do | |
print("Echo:", message) | |
end | |
end | |
local serve = h.tcp:listen(8000) |
This file contains hidden or 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 json | |
import vanilla | |
h = vanilla.Hub() | |
users = ['antirez', 'justinrosenthal', 'jverkoey'] | |
done = ( |
This file contains hidden or 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 vanilla | |
h = vanilla.Hub() | |
serve = h.http.listen() | |
client = h.http.connect('http://localhost:%s' % serve.port) | |
response = client.get('/') | |
conn = serve.recv() # recvs http connection |
This file contains hidden or 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 vanilla | |
h = vanilla.Hub() | |
def handle_request(request): | |
print request | |
request.reply(vanilla.http.Status(200), {}, "Hello") |
This file contains hidden or 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
lines = h.pipe() | |
@h.spawn | |
def _(): | |
while True: | |
line = child.stdout.recv_partion('\n') | |
lines.send(line) | |
lines.pipe(out) |
This file contains hidden or 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 vanilla | |
h = vanilla.Hub() | |
b = h.bean(8080) | |
@b.websocket('/') | |
def _(ws): | |
child = h.process.execv(['/usr/bin/env', 'grep', '--line-buffered', 'foo']) | |
child.stdout.pipe(ws) |
This file contains hidden or 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 vanilla | |
h = vanilla.Hub() | |
b = h.bean(8080) | |
@b.websocket('/') | |
def _(ws): | |
child = h.process.execv(['/usr/bin/env', 'grep', '--line-buffered', 'foo']) | |
child.stdout.pipe(ws) |
This file contains hidden or 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
> python | |
Python 2.7.6 (default, Sep 9 2014, 15:04:36) | |
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import vanilla | |
>>> h = vanilla.Hub() | |
>>> child = h.process.execv(['/usr/bin/env', 'grep', '--line-buffered', 'foo']) | |
>>> child.stdin.send('foo1\n') | |
>>> child.stdout.recv() | |
'foo1\n' |
This file contains hidden or 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 argparse | |
from oauth2client.client import flow_from_clientsecrets | |
from oauth2client.file import Storage | |
from oauth2client import tools | |
def main(): | |
storage = Storage('a_credentials_file') | |
creds = storage.get() |