Skip to content

Instantly share code, notes, and snippets.

View mkocikowski's full-sized avatar

Mik Kocikowski mkocikowski

View GitHub Profile
@mkocikowski
mkocikowski / gist:9283114
Created March 1, 2014 01:00
Take str or unicode in, return utf-8 encoded string, with 'bad' characters stripped
def utf8(data):
"""Takes in str or unicode, returns utf-8 string, stripping invalid chars."""
if type(data) not in [str, unicode]:
raise TypeError("'data' must be str or unicode")
try:
if type(data) is unicode:
s = data.encode('utf-8', 'ignore')
elif type(data) is str:
@mkocikowski
mkocikowski / gist:8325452
Last active January 2, 2016 15:48
esbench 100gb macbookpro test dump
curl -XPUT 'http://localhost:9200/esbench_stats/bench/351b0aa5' -d '{"cluster": {"cluster_name": "mik_local", "node_count": 1, "ok": true, "nodes": {"eQDp6TjSQ8C-9_5ktiyLDA": {"thread_pool": {"index": {"max": 8, "queue_size": "200", "type": "fixed", "min": 8}, "search": {"max": 24, "queue_size": "1k", "type": "fixed", "min": 24}, "management": {"max": 5, "keep_alive": "5m", "type": "scaling", "min": 1}, "get": {"max": 8, "queue_size": "1k", "type": "fixed", "min": 8}, "generic": {"keep_alive": "30s", "type": "cached"}, "suggest": {"max": 8, "queue_size": "1k", "type": "fixed", "min": 8}, "refresh": {"max": 4, "keep_alive": "5m", "type": "scaling", "min": 1}, "bulk": {"max": 8, "queue_size": "50", "type": "fixed", "min": 8}, "merge": {"max": 4, "keep_alive": "5m", "type": "scaling", "min": 1}, "snapshot": {"max": 4, "keep_alive": "5m", "type": "scaling", "min": 1}, "percolate": {"max": 8, "queue_size": "1k", "type": "fixed", "min": 8}, "flush": {"max": 4, "keep_alive": "5m", "type": "scaling", "min": 1}, "warm