Skip to content

Instantly share code, notes, and snippets.

@forbesmyester
forbesmyester / remove_all_es_indices
Last active December 30, 2015 23:32
Bash to remove all ES indices
#!/bin/bash
curl 'localhost:9200/_cat/indices?v' | awk '{ print $3 }' | grep -v '^\.' | tr '\n' '\0' | xargs -n 1 -0 -I {} curl -X DELETE "http://localhost:9200/{}"
@forbesmyester
forbesmyester / quick_unit_tests
Last active December 24, 2015 10:54
Quick Unit Tests in Docker
#!/bin/bash
# Run tests (or anything else) in Docker by doing a tagged build and then run, which should make things much faster.
#
# @author forbesmyester
# @license MIT
DOCKER_TAG=$(echo $PWD | tr '[:upper:]' '[:lower:]' | sed 's/^\///' | sed 's/\//-/g')
echo ""
echo "== USING DOCKER TAG: test-$DOCKER_TAG =========================="
@forbesmyester
forbesmyester / nginx-proxy-dns
Last active August 29, 2015 14:22
Adds hosts which are generated for `https://github.com/jwilder/nginx-proxy` to your local /etc/hosts file (tested in Ubuntu)
#!/bin/bash
export DOCKER_GEN_VERSION="0.3.9"
# Generates a new /etc/hosts whenever a docker host is added with a VIRTUAL_HOST environmental variable ( see super useful project at https://github.com/jwilder )
# Code here shamelessly stolen from
# * https://github.com/jwilder/nginx-proxy/blob/master/Dockerfile
# * http://unix.stackexchange.com/questions/81685/how-to-remove-multiple-newlines-at-eof
#!/bin/sh
cat /dev/urandom | base64 | sed 's/[^A-Za-z0-9]//' | head -c 8