Skip to content

Instantly share code, notes, and snippets.

def take(iterable, num):
for i, elem in enumerate(iterable):
yield elem
if i + 1 == num:
break
def chain_pop(*iterable):
for elem in iterable:
while True:
try:
@benoit-intrw
benoit-intrw / gist:cccb2eee54c0528e7a58
Created March 17, 2015 13:31
Dailymotion stream manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns="http://ns.adobe.com/f4m/1.0">
<id>live</id>
<startTime>2006-07-24T07:15:00+01:00</startTime>
<mimeType>video/mp4</mimeType>
<streamType>live</streamType>
<deliveryType>streaming</deliveryType>
<bootstrapInfo
id="boot-live-audio=128000-video=2200000"
@benoit-intrw
benoit-intrw / cluster_settings
Created October 25, 2013 12:49
nodes stats and cluster setting
{
"persistent": {},
"transient": {
"indices.cache.filter.size": "30%"
}
}
@benoit-intrw
benoit-intrw / gist:6463110
Created September 6, 2013 12:28
/_nodes/hot_threads output
::: [sissor2][2hXe71VwRO6qAkz09mHlEw][inet[/192.168.110.90:9300]]
38.4% (192ms out of 500ms) cpu usage by thread 'elasticsearch[sissor2][search][T#48]'
10/10 snapshots sharing following 179 elements
org.apache.lucene.search.vectorhighlight.XFieldQuery$QueryPhraseMap.addToMap(XFieldQuery.java:420)
org.apache.lucene.search.vectorhighlight.XFieldQuery$QueryPhraseMap.addToMap(XFieldQuery.java:420)
org.apache.lucene.search.vectorhighlight.XFieldQuery$QueryPhraseMap.addToMap(XFieldQuery.java:420)
org.apache.lucene.search.vectorhighlight.XFieldQuery$QueryPhraseMap.addToMap(XFieldQuery.java:420)
org.apache.lucene.search.vectorhighlight.XFieldQuery$QueryPhraseMap.addToMap(XFieldQuery.java:420)
org.apache.lucene.search.vectorhighlight.XFieldQuery$QueryPhraseMap.addToMap(XFieldQuery.java:420)
@benoit-intrw
benoit-intrw / elasticsearch .log
Created August 29, 2013 06:56
NullPointerException on empty filter with 0.90.3
[2013-08-29 08:43:32,061][INFO ][node ] [Iron Man] version[0.90.3], pid[8222], build[5c38d60/2013-08-06T13:18:31Z]
[2013-08-29 08:43:32,062][INFO ][node ] [Iron Man] initializing ...
[2013-08-29 08:43:32,062][DEBUG][node ] [Iron Man] using home [/home/blaurent/downloads/elasticsearch-0.90.3], config [/home/blaurent/downloads/elasticsearch-0.90.3/config], data [[/home/blaurent/downloads/elasticsearch-0.90.3/data]], logs [/home/blaurent/downloads/elasticsearch-0.90.3/logs], work [/home/blaurent/downloads/elasticsearch-0.90.3/work], plugins [/home/blaurent/downloads/elasticsearch-0.90.3/plugins]
[2013-08-29 08:43:32,067][INFO ][plugins ] [Iron Man] loaded [], sites []
[2013-08-29 08:43:32,086][DEBUG][common.compress.lzf ] using [UnsafeChunkDecoder] decoder
[2013-08-29 08:43:32,096][DEBUG][env ] [Iron Man] using node location [[/home/blaurent/downloads/elasticsearch-0.90.3/data/elasticsearch/nodes/0]], local_nod
@benoit-intrw
benoit-intrw / gist:5014658
Created February 22, 2013 16:29
Elasticsearch: test french stemmer
#!/bin/bash
# Script and configuration to test stemmer
#
# Check arguments
hostname=$1
indexname=$2
if [ -z "$hostname" ] || [ -z "$indexname" ]
then
@benoit-intrw
benoit-intrw / gist:4059732
Created November 12, 2012 14:31
NullPointerException with prefix query
See https://groups.google.com/d/topic/elasticsearch/OA4rlKL5DNg/discussion for context.
The query :
{
"query": {
"prefix": {
"field^2": "pre"
}
}
@benoit-intrw
benoit-intrw / test_analyzer.sh
Created August 23, 2012 10:06
Elasticsearch: test analyser for text like 'R&D' or 'Canal+'
#!/bin/bash
# Script and configuration to test analyser
#
# Check arguments
hostname=$1
indexname=$2
if [ -z "$hostname" ] || [ -z "$indexname" ]
then
@benoit-intrw
benoit-intrw / gist:3018231
Created June 29, 2012 14:20
Elasticsearch: Date sorting and dateOptionalTime format (default one) problem.
echo -n "Deleting ... "
curl -XDELETE http://localhost:9200/test_date
echo ""
echo -n "Create index ... "
curl -XPUT http://localhost:9200/test_date
echo ""
echo -n "Put mapping ... "
curl -XPUT http://localhost:9200/test_date/test/_mapping -d '
{
"test":{