Skip to content

Instantly share code, notes, and snippets.

View hirokiky's full-sized avatar

Hiroki Kiyohara hirokiky

View GitHub Profile
@hirokiky
hirokiky / README.md
Created October 13, 2015 01:35
Trying falcon for proxy server
@hirokiky
hirokiky / msgvjson.py
Created July 25, 2015 06:50
msgpack vs json
import msgpack
data = {} # Input large Python dict
import time
import json
print("Dumping")
print("########### msgpack ##############")
print("started")
@hirokiky
hirokiky / error.txt
Created June 16, 2015 00:55
Error when updating contents which name is as Unicode.
2015-06-16 09:42:09,565 ERROR [waitress][Dummy-4] Exception when serving /manage/terms/ティ/@@properties
Traceback (most recent call last):
File "/home/hirokiky/dev/deepthought/env/lib/python3.4/site-packages/waitress/channel.py", line 337, in service
task.service()
File "/home/hirokiky/dev/deepthought/env/lib/python3.4/site-packages/waitress/task.py", line 173, in service
self.execute()
File "/home/hirokiky/dev/deepthought/env/lib/python3.4/site-packages/waitress/task.py", line 392, in execute
app_iter = self.channel.server.application(env, start_response)
File "/home/hirokiky/dev/deepthought/env/lib/python3.4/site-packages/pyramid-1.6a1-py3.4.egg/pyramid/router.py", line 223, in __call__
response = self.invoke_subrequest(request, use_tweens=True)
@hirokiky
hirokiky / easyscript.py
Created June 10, 2015 00:55
Basic form of Python scripts.
"""
Usage
=====
::
$ python easyscript.py 1 2
3
"""
@hirokiky
hirokiky / README.md
Created June 8, 2015 00:31
Dynamic locust tasks

Dynamic tasks for locust.io

Install

pip install locustio

Try it

@hirokiky
hirokiky / kind_of_shit_fluent.conf
Created May 21, 2015 02:46
Fluentd: Enjoy forever. This config causes `stack level too deep (SystemStackError)`. Allof memory willbe eaten, No log will be executed and your server will fail...
<source>
type forward
</source>
<match **>
type record_reformer
renew_record false
enable_ruby true
tag ip_formatted.${tag}
@hirokiky
hirokiky / README.md
Created May 19, 2015 08:46
Proxy server by using aiohttp.

Async Proxy Server

Installation

pip install -r requirements.txt

Run

Run the backend server

@hirokiky
hirokiky / forms.py
Created March 22, 2015 07:35
weiwei's widget
class WidgetForm(object):
def is_valid(self):
pass
def __str__(self):
widget_forms = {
widget_code: modelformset_factory(widget_class)
for widget_code, widget_class in widgets.widgets.items()
}
@hirokiky
hirokiky / callpraphmiddleware.py
Created March 2, 2015 06:36
Django Middleware to show call graph.
from pycallgraph import PyCallGraph
from pycallgraph import Config
from pycallgraph import GlobbingFilter
from pycallgraph.output import GraphvizOutput
class ProfilerMiddleware(object):
includes = []
def can(self, request):
@hirokiky
hirokiky / profmiddleware.py
Created March 2, 2015 05:00
ProfileをするDjango middleware
from io import StringIO
import cProfile
import pstats
from django.conf import settings
class ProfilerMiddleware(object):
""" プロファイラーを実行するMiddleware