Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
# -- stdlib --
import json
import os
import urllib2
# -- third party --
# -- own --
# -- code --
curl -XPUT localhost:9200/_template/logstash -d @logstashtemplate.json
{
"template" : "logstash*",
"mappings" : {
"tengine" : {
"_source" : {
"compress" : true
},
{
"template": "logstash-*",
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"index" : {
"query" : { "default_field" : "@message" },
"store" : { "compress" : { "stored" : true, "tv": true } }
}
},
@evilabandon
evilabandon / mprocessingtaobaoip.py
Created April 11, 2013 03:51
python multiprocessing
#!/home/yinyong/app/python/bin/python
# -*- coding=utf-8 -*-
#module
import multiprocessing
import urllib2
import json
import os
import sys
reload(sys)
@evilabandon
evilabandon / daemon.py
Created April 2, 2013 04:52
A generic daemon class. daemon with apscheduler
#!/usr/bin/env python
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method