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
# Here are the contents of the synonym file that is located here: analysis/synonym_test.txt | |
test1, a+b | |
test2, b+c | |
test3, d/c | |
work, business | |
# Create the index | |
curl -XPOST localhost:9200/es-syntest -d '{ | |
"settings" : { | |
"number_of_shards" : 1, |
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
from functools import wraps | |
def memoise(wrapped): | |
cache = {} | |
@wraps(wrapped) | |
def wrapper(*args, **kwargs): | |
key = (args, tuple(sorted(kwargs.items()))) | |
if key not in cache: |
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
#full details now available: http://tiredblogger.wordpress.com/2011/12/28/finding-todos-and-reporting-in-powershell/ | |
param( | |
#this is appalling; there has to be a better way to get the raw name of "this" directory. | |
[string]$DirectoryMask = (get-location), | |
[array]$Include = | |
@("*.spark","*.cs","*.js","*.coffee","*.rb"), | |
[array]$Exclude = | |
@("fubu-content","packages","build","release"), | |
[switch]$Html, |
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 'http://localhost:9200/_template/template_logstash/' -d ' | |
{ | |
"template": "logstash-*", | |
"mappings": { | |
"_default_": { | |
"_source": { "compress": "true" }, | |
"_all" : {"enabled" : false} | |
} | |
} | |
}' |
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/test -d ' | |
{ | |
"settings" : { | |
"index": { | |
"analysis": { | |
"analyzer": { | |
"manualindexanalyzer": { | |
"type": "custom", | |
"tokenizer": "whitespace", | |
"filter": [ |
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 GeoClusterer { | |
private final double maxDistance; | |
private final List<GeoCluster> clusters = Lists.newArrayList(); | |
public GeoClusterer(double maxDistance, DistanceUnit unit) { | |
this.maxDistance = unit.convert(maxDistance, unit, DistanceUnit.KILOMETERS); | |
} | |
public GeoCluster add(GeoPoint point) { |
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
#!/bin/bash | |
# herein we backup our indexes! this script should run at like 6pm or something, after logstash | |
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas, | |
# compress the data files, create a restore script, and push it all up to S3. | |
TODAY=`date +"%Y.%m.%d"` | |
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES | |
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/" | |
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put" | |
BACKUPDIR="/mnt/es-backups/" | |
YEARMONTH=`date +"%Y-%m"` |
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
/* | |
* Licensed to Jörg Prante and xbib under one or more contributor | |
* license agreements. See the NOTICE.txt file distributed with this work | |
* for additional information regarding copyright ownership. | |
* | |
* Copyright (C) 2012 Jörg Prante and xbib | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU Affero General Public License as published | |
* by the Free Software Foundation; either version 3 of the License, or |
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
<!DOCTYPE html> | |
<html manifest="cache.manifest"> | |
<head> <title>d3 example</title> </head> | |
<body> | |
<div id='d3TutoGraphContainer'></div> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script type="text/javascript" src="http://d3js.org/d3.v2.min.js"></script> |
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
var script = document.createElement("script"); | |
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); | |
document.body.appendChild(script); | |
}, false); | |
document.body.appendChild(script); |