Skip to content

Instantly share code, notes, and snippets.

@xueruini
xueruini / context_local.py
Created March 8, 2017 06:29 — forked from virtuald/context_local.py
Implements a threadlocal-like mechanism for Tornado
'''
This is significantly derived from StackContext, Apache 2.0 license
'''
from tornado.stack_context import StackContextInconsistentError, _state
class ContextLocal(object):
'''
Implements a threadlocal-like mechanism that can be used to track data
across tornado asynchronous calls. This is very similar to (and based
@xueruini
xueruini / snippets.sh
Last active March 31, 2017 07:59
shell snippets
# update all docker images
docker images | tail -n +2 | awk '{printf "%s:%s\n", $1, $2}' | xargs -n 1 docker pull
# cleanup untagged images
docker images | grep "^<none>" | awk '{print $3}' | xargs -n 1 docker rmi
@xueruini
xueruini / keybase.md
Created June 13, 2017 03:38
keybase.md

Keybase proof

I hereby claim:

  • I am xueruini on github.
  • I am xueruini (https://keybase.io/xueruini) on keybase.
  • I have a public key ASA7u4h44W80wJyCu5vMJx-BsR-7p4bRCMwlT_GibIo_lAo

To claim this, I am signing this object:

@xueruini
xueruini / a.sh
Created November 2, 2017 10:59
search
HOST=http://elasticsearch.dev-id.internal.hyku.org:9200
# drop index
curl -XDELETE $HOST/my_index
# create index
curl -XPUT $HOST/my_index -d '{
"settings":{
"analysis":{