Skip to content

Instantly share code, notes, and snippets.

View oberstet's full-sized avatar

Tobias Oberstein oberstet

View GitHub Profile
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.static import File
from pprint import pprint
root = File(".")
pprint(root.contentTypes)
site = Site(root)
reactor.listenTCP(8080, site)
reactor.run()
oberstet@corei7ub1310:~/scm/tavendo/autobahn/AutobahnPython/autobahn$ tox
GLOB sdist-make: /home/oberstet/scm/tavendo/autobahn/AutobahnPython/autobahn/setup.py
py26twisted inst-nodeps: /home/oberstet/scm/tavendo/autobahn/AutobahnPython/autobahn/.tox/dist/autobahn-0.8.12.zip
py26twisted runtests: PYTHONHASHSEED='146605569'
py26twisted runtests: commands[0] | sh -c which python
/home/oberstet/scm/tavendo/autobahn/AutobahnPython/autobahn/.tox/py26twisted/bin/python
py26twisted runtests: commands[1] | sh -c which trial
/home/oberstet/scm/tavendo/autobahn/AutobahnPython/autobahn/.tox/py26twisted/bin/trial
py26twisted runtests: commands[2] | python -V
Python 2.6.9
$ python get_stats.py
0.8.12
{'last_day': 2576, 'last_month': 53080, 'last_week': 9282}
oberstet@COREI7 ~/scm/tavendo/infrequent/scratchbox/python/pypi (master)
$ python get_stats2.py
{'day': 1485, 'month': 53441, 'week': 9643}
oberstet@COREI7 ~/scm/tavendo/infrequent/scratchbox/python/pypi (master)
$
from autobahn.asyncio.wamp import ApplicationSession
class MyComponent(ApplicationSession):
def onJoin(self, details):
print("session established")
if __name__ == "__main__":
import mistune
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import HtmlFormatter
import json
import re
import copy
class MyInlineGrammar(mistune.InlineGrammar):
###############################################################################
##
## Copyright (C) 2014 Tavendo GmbH
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
###############################################################################
##
## Copyright (C) 2014 Tavendo GmbH
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
oberstet@THINKPAD-T410S /c/Temp
$ crossbar init --template hello:php
Initializing application template 'hello:php' in directory 'c:\Temp'
Using template from 'c:/Python27/lib/site-packages/crossbar-0.9.9-py2.7.egg/crossbar/templates/hello/php'
Creating directory c:\Temp\.crossbar
Creating directory c:\Temp\web
Creating file c:\Temp\.gitignore
Creating file c:\Temp\client.php
Creating file c:\Temp\Makefile
Creating file c:\Temp\README.md
oberstet@THINKPAD-T410S /c/Temp
$ crossbar start
2014-10-28 21:54:34+0100 [Controller 5900] Log opened.
2014-10-28 21:54:34+0100 [Controller 5900] ============================== Crossbar.io ==============================
2014-10-28 21:54:34+0100 [Controller 5900] Crossbar.io 0.9.9 starting
2014-10-28 21:54:37+0100 [Controller 5900] Running on CPython using IOCPReactor reactor
2014-10-28 21:54:37+0100 [Controller 5900] Starting from node directory c:\Temp\.crossbar
2014-10-28 21:54:38+0100 [Controller 5900] Starting from local configuration 'c:\Temp\.crossbar\config.json'
2014-10-28 21:54:38+0100 [Controller 5900] Warning, could not set process title (setproctitle not installed)
WebRealms.networking.connection = new autobahn.Connection({
url: 'ws://' + WebRealms.networking.hostname + ':9000/ws/',
realm: 'WebRealms',
authmethods: ["wampcra"],
authid: 'Tester'
});