Skip to content

Instantly share code, notes, and snippets.

jeffsteinmetz / elasticsearch-rolling-upgrade.yml
Created December 18, 2015 19:08
Ansible Elasticsearch Rolling Upgrade Example
View elasticsearch-rolling-upgrade.yml
# 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
jeffsteinmetz / equilibrium.scala
Created September 3, 2015 06:15
My purely functional Scala solution to the equilibrium index problem by codility
View equilibrium.scala
// 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:
// 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
jeffsteinmetz / gist:2ea8329c667386c80fae
Last active August 29, 2015 14:13
Determine list [array] size in elasticsearch issue
View gist:2ea8329c667386c80fae
# 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
curl -XDELETE 'http://'$NODE':9200/'$INDEX_NAME
curl -XPUT 'http://'$NODE':9200/'$INDEX_NAME'/' -d '{
jeffsteinmetz / gist:063bd3237033f3af2ed9
Last active October 20, 2023 22:20
Generate Unique, Hashed, Random Token in Scala for use in API calls or as an OAuth Token Bearer
View gist:063bd3237033f3af2ed9
import scala.util._
* Generates a Bearer Token with a length of
* 32 characters (MD5) or 64 characters (SHA-256) according to the
* specification RFC6750 (
* Uniqueness obtained by hashing system time combined with a