Skip to content

Instantly share code, notes, and snippets.

View mivade's full-sized avatar
👋

Mike DePalatis mivade

👋
View GitHub Profile
@methane
methane / gist:2185380
Created March 24, 2012 17:28
Tornado Example: Delegating an blocking task to a worker thread pool from an asynchronous request handler
from time import sleep
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application, asynchronous, RequestHandler
from multiprocessing.pool import ThreadPool
_workers = ThreadPool(10)
def run_background(func, callback, args=(), kwds={}):
def _callback(result):
@ajdavis
ajdavis / client.py
Created May 22, 2013 21:12
Big download demo with Tornado 3.0.1 and pycurl.
from tornado.httpclient import HTTPRequest, AsyncHTTPClient
import tornado.ioloop
import tornado.web
from tornado import gen
GB = 1024 * 1024 * 1024
total_downloaded = 0
def streaming_callback(chunk):
@yanmhlv
yanmhlv / gist:6220591
Created August 13, 2013 12:25
Launch PyQt4 with tornado
import tornado.ioloop
import tornado.autoreload
from PyQt4 import QtGui
import sys
class Window(QtGui.QWidget):
def __init__(self):
super(Window, self).__init__()
self.timer = tornado.ioloop.PeriodicCallback(self.printable, 300)
self.timer.start()
@YukiSakamoto
YukiSakamoto / hdf5_simple.cpp
Created August 23, 2013 13:41
simple example to write hdf5 using c++.
#include <string>
#include <iostream>
#include "H5Cpp.h"
#define MAX_NAME_LENGTH 32
const std::string FileName("SimpleCompound.h5");
const std::string DatasetName("PersonalInformation");
const std::string member_age("Age");
const std::string member_sex("Sex");
const std::string member_name("Name");
@arvidfm
arvidfm / asyncio-tornado.py
Last active December 4, 2018 12:56
Running Tornado on asyncio's event loop, including 'yield from' support in request handlers
import asyncio
import tornado.concurrent
import tornado.ioloop
import tornado.web
import tornado.platform.asyncio
import tornado.httpclient
class ReqHandler(tornado.web.RequestHandler):
async def get(self):
@UnderGreen
UnderGreen / installation.rst
Last active October 29, 2020 12:52 — forked from marcinkuzminski/installation.rst
Installation instruction for Kallithea

Setting up Kallithea on Ubuntu Server 12.04

Preparation

  1. Install Ubuntu Server.
  2. Update Ubuntu with the commands:
@drgarcia1986
drgarcia1986 / __main__.py
Last active September 10, 2024 20:08
Example of OAuth2 autentication server with Client Credentials grant (using python-oauth2 and tornado)
# !/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Diego Garcia'
import tornado.web
import tornado.ioloop
import oauth2.tokengenerator
import oauth2.grant
import oauth2.store.redisdb
import oauth2.store.mongodb
@yoavram
yoavram / .travis.yml
Last active June 7, 2019 11:30
Build and deploy conda packages to Anaconda.org from Travis-CI
language: python
python:
- 2.7
- 3.4
# Setup anaconda
before_install:
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- ./miniconda.sh -b
@a10y
a10y / nginx.conf
Last active January 23, 2016 08:55
Nginx + LetsEncrypt Configuration With Proxying to Github Pages
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name aduffy.org;