Skip to content

Instantly share code, notes, and snippets.

View methane's full-sized avatar

Inada Naoki methane

  • KLab Inc,
  • Japan
  • 11:48 (UTC +09:00)
  • X @methane
View GitHub Profile
package main
import (
"fmt"
"log"
"net"
"sync"
)
const BUFSIZE = 64
$ python s.py
Falling asleep
Falling asleep
Falling asleep
Falling asleep
Falling asleep
Falling asleep
Falling asleepFalling asleep
Falling asleep
In [2]: list.
list.append list.extend list.insert list.pop list.reverse
list.count list.index list.mro list.remove list.sort
In [2]: list.in
list.index list.insert
In [2]: list.index?
Type: method_descriptor
String Form:<method 'index' of 'list' objects>
@methane
methane / redis_test.go
Last active August 29, 2015 13:57
Redis benchmark in Golang
// To run this test.
// $ go get github.com/garyburd/redigo/redis
// $ go test -bench=.
package main
import (
"fmt"
"log"
"math/rand"
using System;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
namespace wsecho
{
class MainClass
{
static HttpListener listener;
import pymemcache.client
import time
client = pymemcache.client.Client(('localhost', 11211))
for _ in range(1000):
for i in range(10000):
k = "foo%d" % i
x = str(time.time())
if not isinstance(x, bytes):
$ python sample.py
...........................................................................................................................................................................................................................................................ERROR:sqlalchemy.pool.QueuePool:Exception closing connection None
Traceback (most recent call last):
File "/Users/inada-n/venvs/flask-gevent-pymysql/lib/python2.7/site-packages/sqlalchemy/pool.py", line 244, in _close_connection
self._dialect.do_close(connection)
File "/Users/inada-n/venvs/flask-gevent-pymysql/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 411, in do_close
dbapi_connection.close()
AttributeError: 'NoneType' object has no attribute 'close'
Traceback (most recent call last):
File "/Users/inada-n/venvs/flask-gevent-pymysql/lib/python2.7/site-packages/gevent/greenlet.py", line 327, in run
from __future__ import print_function, division, absolute_import
import flask
app = flask.Flask(__name__)
@app.route('/')
def index():
return u'Hello'
@app.after_request
@methane
methane / router.txt
Last active August 29, 2015 14:02
トップレベルの router 廃止して slot 方式にする案
<source>
type in_tail
tag apache.t
</source>
<match apache.t>
type parser
format apache
tag apache.p
</match>
import os
class TargetRunner(object):
def __init__(self, target, directory, stdout, stderr, args):
self.target = target
self.directory = directory
self.stdout = stdout
self.stderr = stderr
self.args = args