This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo hallo | python -c "import sys;[sys.stdout.write(line) for line in sys.stdin]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sophon.search; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.Properties; | |
/** | |
* Created by yinchunxiang on 05/06/2017. | |
*/ | |
public class Config { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io" | |
"io/ioutil" | |
"net/url" | |
"github.com/benburkert/http" | |
//"net/http" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import httplib | |
import time | |
chunk1 = "custname=bob&custtel=11111&custemail=bob%40email.com&si" | |
chunk2 = "ze=medium&topping=bacon&delivery=11%3A00&comments=if+you%27re+late+we+get+it+free" | |
if __name__ == "__main__": | |
#conn = httplib.HTTPConnection('httpbin.org') | |
#conn = httplib.HTTPConnection('requestb.in') | |
conn = httplib.HTTPConnection('ros.roobo.net') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func trace() { | |
pc := make([]uintptr, 10) // at least 1 entry needed | |
runtime.Callers(2, pc) | |
f := runtime.FuncForPC(pc[0]) | |
file, line := f.FileLine(pc[0]) | |
fmt.Printf("%s:%d %s\n", file, line, f.Name()) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map "ctrl+f" scrollFullPageDown | |
map "ctrl+b" scrollFullPageUp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ThreadPool { | |
public: | |
ThreadPool(int num_threads) : stop_(0) { | |
for (int i = 0; i < num_threads; ++i) { | |
threads_.push_back(std::thread(&ThreadPool::run, this)); | |
} | |
} | |
void AddTask(const std::function<void()> &task) { | |
{ | |
std::unique_lock<std::mutex> lock(mutex_); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPUT localhost:9200/_cluster/settings -d '{"transient":{"cluster.routing.allocation.disable_allocation": true}}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Can be used without specifying an index against one of the many built in analyzers: | |
curl -XGET 'localhost:9200/_analyze?analyzer=standard' -d 'this is a test' | |
Or by building a custom transient analyzer out of tokenizers, token filters and char filters. Token filters can use the shorter filters parameter name: | |
curl -XGET 'localhost:9200/_analyze?tokenizer=keyword&filters=lowercase' -d 'this is a test' | |
curl -XGET 'localhost:9200/_analyze?tokenizer=keyword&token_filters=lowercase&char_filters=html_strip' -d 'this is a <b>test</b>' | |
It can also run against a specific index: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SELECT COUNT(*) from bank GROUP BY state ORDER BY COUNT(*) DESC | |
curl -XPOST 'localhost:9200/bank/_search?pretty' -d ' | |
{ | |
"size": 0, | |
"aggs": { | |
"group_by_state": { | |
"terms": { | |
"field": "state" | |
} |
NewerOlder