Skip to content

Instantly share code, notes, and snippets.

View TigerND's full-sized avatar

Aleksandr Zykov TigerND

  • Vilnius, Lithuania
View GitHub Profile
INSTALLED_APPS = [
# ...
'djangocms_tonicdev',
# ...
]
INSTALLED_APPS = [
# ...
    'dtx',
# ...
]
DTX_WEB_SITES = (
( # Handle example app by Twisted
u'.*/example/test/',
'example.urls',
),
( # Handle all other requests by WSGI
u'.*',
'wsgi',
),
)
urlpatterns = patterns('',
url(r'^example/test/(?P<item_id>.*)/',
'example.views.gw2test',
{ 'api': 'https://api.guildwars2.com/v1/' }
)
)
@inlineCallbacks
def gw2test(request, item_id, api):
x = yield getPage(api + 'item_details.json?item_id=' + str(item_id))
details = json.loads(x)
returnValue(HttpResponse(
str(details['name']),
content_type='text/plain'
))
import asyncio
async def slow_operation(n):
await asyncio.sleep(1)
print("Slow operation {} complete".format(n))
async def main():
await asyncio.wait([
slow_operation(1),
slow_operation(2),
import asyncio
@asyncio.coroutine
def slow_operation(n):
yield from asyncio.sleep(1)
print("Slow operation {} complete".format(n))
@asyncio.coroutine
def main():
yield from asyncio.wait([
cd plugins
ln -s disabled-Multiuser Multiuser
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream zeronet_backend {
server 127.0.0.1:43110;
}
server {
var httpRequest = require('request');
var urljoin = require('url-join');
var nmcpp = require('nmcpp');
var DNSChainProvider = nmcpp.Provider.extend({
init: function(opts) {
this.addr = opts.addr;
},
load: function(name, callback) {
httpRequest({