Test if a file exits
if [ ! -f /tmp/foo.txt ]; then
echo "File not found!"
fi
# Previous example | |
# https://gist.github.com/hscells/774e112d14e3f249e8960d7147d61353 | |
# Access the term vector for the `body` field | |
# https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html | |
curl -X GET "localhost:9200/example/doc/AV3OdFAZ7fqYee2bfgSQ/_termvectors?term_statistics&fields=body" | |
# => | |
# { | |
# "_index" : "example", | |
# "_type" : "doc", |
# 1. Start Elasticsearch | |
# ./bin/elasticsearch, docker run ... | |
# 2. Create index | |
# https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html | |
curl -X PUT http://localhost:9200/example | |
# => {"acknowledged":true,"shards_acknowledged":true} | |
# 3. Add a document | |
# https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html |
[ | |
{ | |
"_id": "e3fe32d0-7dd6-11e7-b648-2bc197fbff8a", | |
"_type": "dashboard", | |
"_source": { | |
"title": "Publications", | |
"hits": 0, | |
"description": "", | |
"panelsJSON": "[{\"col\":1,\"id\":\"9bd57360-7dd6-11e7-b648-2bc197fbff8a\",\"panelIndex\":1,\"row\":1,\"size_x\":7,\"size_y\":3,\"type\":\"visualization\"},{\"col\":7,\"id\":\"6e1d38b0-7dde-11e7-b648-2bc197fbff8a\",\"panelIndex\":3,\"row\":4,\"size_x\":6,\"size_y\":6,\"type\":\"visualization\"},{\"col\":1,\"id\":\"1f353c80-7dd8-11e7-b648-2bc197fbff8a\",\"panelIndex\":4,\"row\":10,\"size_x\":12,\"size_y\":4,\"type\":\"visualization\"},{\"col\":1,\"id\":\"edbc1750-7de1-11e7-9902-0decf2213372\",\"panelIndex\":5,\"row\":4,\"size_x\":6,\"size_y\":6,\"type\":\"visualization\"},{\"size_x\":5,\"size_y\":3,\"panelIndex\":6,\"type\":\"visualization\",\"id\":\"49c94ea0-7de2-11e7-9902-0decf2213372\",\"col\":8,\"row\":1}]", | |
"optionsJSON": "{\"darkTheme\":false}", |
# http://www.front2backdev.com/2015/08/26/pulling-and-splitting-live-xml/ | |
input { | |
file { | |
path => "/Users/harryscells/Docker/sigir2017-elastic4ir/*.xml" | |
start_position => "beginning" | |
sincedb_path => "NUL" | |
codec => multiline { | |
pattern => "<PubmedArticle>|</PubmedArticleSet>" | |
negate => true | |
what => "previous" |
package main | |
// Node is a struct that represents any node in a tree | |
type Node struct { | |
Name string | |
Children []Node | |
} | |
// Traverse is a function that prints the name of each Node in a tree of Nodes. | |
func (n Node) Traverse() { |
Test if a file exits
if [ ! -f /tmp/foo.txt ]; then
echo "File not found!"
fi
with_fx :bitcrusher do | |
with_fx :panslicer do | |
sample :guit_e_fifths, beat_stretch: 60, pitch_dis: 3, pan: 0.2, amp: 10 | |
sample :guit_e_fifths, beat_stretch: 60, pitch_dis: 3, pan: 0.8, amp: 10 | |
end | |
end |
(defn col | |
"get the column n from list lst" | |
([lst n] (col lst n [])) | |
([lst n l] | |
(cond | |
(empty? lst) l | |
:else | |
(recur (rest lst) n (conj l (nth (first lst) n)))))) | |
(defn dot-product [A B] |
I hereby claim:
To claim this, I am signing this object:
W = a.width; | |
H = a.height; | |
U = "#ccc"; | |
s = []; | |
K = []; | |
Z = []; | |
function R(){ | |
return Math.random(); | |
} | |
function F(x,y,w,h,C){ |