Skip to content

Instantly share code, notes, and snippets.

Xiaochen Wang chobits

Block or report user

Report or block chobits

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View luajit-crash-on-first-instruction-of-mcode.txt
mail message modified:
Xiaochen Wang <>
11:07 AM (2 hours ago)
to web-07
hi mike,
We still have an issue, always crashed on first instruction of tracing generated machine code.
chobits /
Last active Dec 20, 2018
test case for updating nginx-1.15.1 modules

Test Case:

  • Case failure:
    • sub_filter_slice.t: current tengine has its slice module, so this case is not run for nginx module.
    • limit_conn_complex.t: limit_req module is not updated.
    • index2.t: current tengine does not merge
    • userid.t: tengine refactor 404 page. It outputs URI in response, the URI has "expires" string, which makes case failed.
chobits /
Created Sep 29, 2015
luajit source notes
 -> lj_ctype_init(L)
   -> setmref(G(L)->ctype_state, cts)
 -> lj_clib_default(L) # init ffi.C (default loader)
   -> cl = clib_new()
      cl->handle = RTLD_DEFAULT   

View test_log_alibaba_tengine_pull_536
$ cd /home/xiaochen.wxc/work/github-xiaochen/tengine-xiaochen
$ cat
export PATH=/home/xiaochen.wxc/work/github-xiaochen/tengine-xiaochen/objs:$PATH
prove -v -I $TEST_NGINX/inc -I $TEST_NGINX/lib \
tests/test-nginx/cases/footer.t \
tests/test-nginx/cases/proxy_no_buffering_chunked.t \
tests/test-nginx/cases/proxy_no_buffering.t \
chobits /
Last active Dec 28, 2015
zlib wrapper for spdy v2/v3
# Used for python 3.3+
# API: decompress, compress
# zlib dictionary support for python:
# For test:
# $ python3
import zlib
spdy_v2_dict = b'''\
chobits / nginx_kqueue_event.txt
Last active Dec 22, 2015
nginx source notes
View nginx_kqueue_event.txt
The available and post_available field of structure ngx_event_t is only used by KQUEUE.
Other event modules (epoll, poll and etc) donest care about it.
For read event, available means size of data ready to read.
For read event(listening event), available means size of listen backlog.
post_avalibale is only used for multi-thread & KQUEUE.
multi_accept directive doesn't matter for kqueue. (see,3638,3661)
chobits /
Created Apr 12, 2012
python: hook exception handler
import sys
def my_excepthook(exc_type, exc_value, tb):
print 'My Excepthook:'
# traceback display: see tb_printinternal from cpython source
print ' Traceback (most recent call last):'
while tb:
filename = tb.tb_frame.f_code.co_filename
name = tb.tb_frame.f_code.co_name
chobits /
Created Apr 5, 2012
Python: how to create finalizer garbage
import gc
class A():
# For Python, finalizers means instance objects with __del__ methods.
def __del__(self):
print gc.garbage
# []
chobits / gist:2205352
Created Mar 26, 2012
python: careful of swaping value
View gist:2205352
>>> class A():
... val = 0
>>> a = A()
>>> a.val, a = 1, a.val # right
>>> a = A()
>>> a, a.val = a.val, 1 # wrong
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'int' object has no attribute 'val'
chobits / gist:2069014
Created Mar 18, 2012
python *args, **kwargs
View gist:2069014
>>> def test(a, b):
... print a, b
>>> test('hello', 'world')
hello world
>>> test(*('hello', 'world')) # tuple
hello world
>>> test(*iter(['hello', 'world'])) # iter
hello world
>>> test(*['hello', 'world']) # list
You can’t perform that action at this time.