This file contains 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 scala.util._ | |
import java.security.SecureRandom | |
import java.security.MessageDigest | |
/* | |
* Generates a Bearer Token with a length of | |
* 32 characters (MD5) or 64 characters (SHA-256) according to the | |
* specification RFC6750 (http://tools.ietf.org/html/rfc6750) | |
* | |
* Uniqueness obtained by hashing system time combined with a |
This file contains 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
# tested against elasticsearch 1.4.1 | |
# groovy script does not accuratly count number of elements in list | |
# if you don't add a mapping to "not_analyze" it is even worse | |
INDEX_NAME='list-count-test' | |
NODE='localhost' | |
curl -XDELETE 'http://'$NODE':9200/'$INDEX_NAME | |
curl -XPUT 'http://'$NODE':9200/'$INDEX_NAME'/' -d '{ |
This file contains 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
// My scala solution (purely functional with no mutable variables) | |
// to the sample codility problem for finding | |
// any equilibrium index in an array of ints with up to | |
// 10 million entries. Description of problem is here: | |
// http://blog.codility.com/2011/03/solutions-for-task-equi.html | |
// this is O(N) and uses a scala List (instead of an Array) to maximize the | |
// speed of .head and .tail operations | |
import scala.annotation.tailrec |
This file contains 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
# Ansible | |
# Rolling Upgrade of Elasticsearch | |
# author: Jeff Steinmetz, @jeffsteinmetz | |
# tested with Ansible 1.8.2 | |
--- | |
- name: Elasticsearch rolling upgrade | |
# Modify hosts to match your inventory group strategy. | |
hosts: search | |
serial: 1 |