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
### | |
# | |
# Preseed for a Debian based machine on kvm | |
# | |
# Boot this file with: press TAB on the installer | |
# add the following to the boot parameters: | |
# | |
# install keymap=en_US locale=en_US netcfg/get_hostname=testserve \ | |
# netcfg/get_domain=carfax.eu preseed/url=http://192.168.XXX.XXX:8000/wheezy.preseed | |
# |
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 bottle | |
from beaker.middleware import SessionMiddleware | |
session_opts = { | |
'session.type': 'memory', | |
'session.cookie_expires': 300, | |
'session.auto': True | |
} | |
app = SessionMiddleware(bottle.app(), session_opts) |
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
from kombu import Exchange | |
from kombu import Queue | |
from kombu import BrokerConnection | |
class ProduceConsume(object): | |
def __init__(self, exchange_name, **options): | |
exchange = Exchange(exchange_name, type='fanout', durable=False) | |
queue_name = options.get('queue', exchange_name+'_queue') | |
self.queue = Queue(queue_name ,exchange) |
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 asyncio | |
loop = asyncio.get_event_loop() | |
async def hello(): | |
await asyncio.sleep(3) | |
print('Hello!') | |
if __name__ == '__main__': | |
loop.run_until_complete(hello()) | |