Setup:
$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
from django.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings | |
from django.utils.encoding import force_unicode | |
import redis | |
class SessionStore(SessionBase): | |
""" Redis store for sessions""" | |
def __init__(self, session_key=None): | |
self.redis = redis.Redis( |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Monkey Patch for tornado | |
""" | |
import cProfile as profile | |
from tornado.options import options | |
from tornado.web import HTTPError |
package main | |
import ( | |
"log" | |
"net/http" | |
"net/http/httputil" | |
"net/url" | |
) | |
func main() { |
Goroutine By Example | |
==================== | |
尹吉峰 2013/11/05 | |
Python Thread | |
------------- | |
```python | |
import time | |
import threading |
""" | |
client.py - AsyncIO Server using StreamReader and StreamWriter | |
This will create 200 client connections to a server running server.py | |
It will handshake and run similar to this: | |
Server: HELLO | |
Client: WORLD |
import asyncio | |
END = b'Bye-bye!\n' | |
@asyncio.coroutine | |
def echo_client(): | |
reader, writer = yield from asyncio.open_connection('localhost', 8000) | |
writer.write(b'Hello, world\n') | |
writer.write(b'What a fine day it is.\n') | |
writer.write(END) |
Babun is “A Windows shell you will love!”
It's a turn-key CygWin distribution for developers and is very easy to install and maintain. For a Python developer, Babun allows working in an almost-POSIX environment – with some limitation, of course. This causes less friction when handling FOSS projects that are often biased towards a standard Linux environment, e.g. by using shell scripts for boot-strapping and things like that.