This file contains 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 java.io.* | |
import java.net.URL | |
import java.net.HttpURLConnection as http | |
data class Response(val status: Int=200, var header: Map<String, List<String>>, var stream: InputStream) | |
object Request { | |
private fun method(method:String, url: String, header: Map<String, String>, followRedirect:Boolean=true): Pair<Response, http> { |
This file contains 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
set -g prefix C-f | |
unbind C-b | |
set -g mouse on | |
bind h select-pane -L | |
bind l select-pane -R | |
bind k select-pane -U | |
bind j select-pane -D | |
bind v copy-mode | |
bind C-v run -b "tmux set-buffer \"$(xclip -o -sel clip)\" && tmux paste-buffer" | |
bind y run -b "tmux show-buffer | xclip -sel clip -i"\; display-message "copy to system" |
This file contains 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
# -*- coding:utf-8 -*- | |
from tornado.ioloop import IOLoop | |
from tornado.web import RequestHandler, Application | |
class MiddleWare(object): | |
def process_request(self, handler): | |
pass | |
def process_response(self, handler): | |
pass |
This file contains 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
# -*- coding:utf-8 -*- | |
from __future__ import absolute_import | |
import sys | |
import greenlet | |
import socket | |
import time | |
from tornado.iostream import IOStream | |
from tornado.gen import coroutine, Return | |
from tornado.concurrent import Future |
This file contains 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
# -*- coding:utf-8 -*- | |
from tornado.gen import coroutine | |
from tornado.concurrent import Future | |
from tornado.ioloop import IOLoop | |
from tornado.httpclient import AsyncHTTPClient | |
from functools import wraps, partial | |
ioloop = IOLoop.instance() | |
AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient") | |
httpclient = AsyncHTTPClient() |
This file contains 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
#!/usr/bin/env python | |
#-*-coding:utf-8 -*- | |
# | |
#Author: alex alex8224 at gmail.com | |
#Create by:2015-08-11 15:50:21 | |
#Last modified:2015-10-10 09:19:05 | |
#Filename:server.py | |
#Description: | |
from __future__ import absolute_import | |
import re |
This file contains 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
class PropertyPublisherMeta(type): | |
"""A metaclass that associates subclasses with Storm L{PropertyRegistry}s. | |
""" | |
def __init__(self, name, bases, dict): | |
if not hasattr(self, "_storm_property_registry"): | |
self._storm_property_registry = PropertyRegistry() | |
elif hasattr(self, "__storm_table__") and hasattr(self, "__refbyname__"): | |
refbyname = getattr(self, "__refbyname__") |
This file contains 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
def __iter__(self): | |
valid_fields = (name for name in dir(self ) if name not in self.exclude_field and (not name.startswith("_"))) | |
for name in valid_fields: | |
prop = getattr(self, name) | |
if isinstance(prop, (unicode, int)): | |
yield name, getattr(self, name) | |
elif isinstance(prop, datetime): | |
yield name, str(getattr(self, name)) | |
elif isinstance(prop, Reference): | |
try: |
This file contains 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 sys | |
import dis | |
import inspect | |
from byteplay import * | |
def wearedcode(fcode): | |
c = Code.from_code(fcode) | |
if c.code[1] == (LOAD_CONST, 'alex'): | |
return fcode |