Skip to content

Instantly share code, notes, and snippets.

@fforbeck
fforbeck / keybase.md
Created November 27, 2016 23:33
keybase

Keybase proof

I hereby claim:

  • I am fforbeck on github.
  • I am fforbeck (https://keybase.io/fforbeck) on keybase.
  • I have a public key ASCsk2AV2WsPAhosHTW23A9I0NuwzfIHdSzpSnKYRaCUUgo

To claim this, I am signing this object:

@fforbeck
fforbeck / hashtag_filter.json
Created July 13, 2016 18:42
ES Template config to preserve hashtag and mentions from tweets, so they can be queried.
"settings": {
"analysis": {
"filter": {
"hashtag_filter": {
"type": "word_delimiter",
"type_table": [
"# => ALPHA",
"@ => ALPHA"
]
}
@fforbeck
fforbeck / set_msg_size_policy.sh
Created June 7, 2016 21:43
Increase RabbitMQ message size for a queue using policy
sudo rabbitmqctl set_policy -p host --apply-to queues max-msg-size "^queue.name.pattern$" '{"max-length-bytes":100000000}'
@fforbeck
fforbeck / csr_conf.template
Last active May 24, 2016 18:30
Script to generate csr, key and crt
[ req ]
distinguished_name="req_distinguished_name"
prompt="no"
[ req_distinguished_name ]
C="<country>"
ST="<state>"
L="1234"
O="1234"
CN="{DOMAIN}"
@fforbeck
fforbeck / purge_queue.sh
Last active March 8, 2016 16:26
RabbitMQ - Purge Queue
rabbitmqctl purge_queue "<target.queue>" -p <vhost>
@fforbeck
fforbeck / configure_queues.sh
Created February 25, 2016 14:19
RabbitMQ - Command Line Setup. Create queue, bindings, exchanges with rabbitmqadmin and rabbitmqctl
#!/usr/bin/env bash
URL="http://localhost:15672/cli/rabbitmqadmin"
VHOST="<>"
USER="<>"
PWD="<>"
QUEUE="<>"
FAILED_QUEUE="<>"
@fforbeck
fforbeck / move_messages.sh
Created February 25, 2016 14:10
RabbitMQ - Shovel Plugin: Move messages from one queue to another via command line
# The command deletes the parameter after all messages are moved origin to target queue
rabbitmqctl set_parameter -p <vhost> shovel "<origin.queue.name>" '{"src-uri":"amqp://<user>:<pwd>@/<vhost_name>","src-queue":"<origin.queue.name>","dest-uri":"amqp://<user>:<pwd>@/<vhost_name>","dest-exchange":"<target.queue.name>","prefetch-count":1,"reconnect-delay":5,"add-forward-headers":false,"ack-mode":"on-confirm","delete-after":"queue-length"}'
@fforbeck
fforbeck / allocate_unassigned_shard.sh
Last active March 10, 2016 19:54
Allocate unassigned shard from Elasticsearch node
##
# http://stackoverflow.com/questions/19967472/elasticsearch-unassigned-shards-how-to-fix
##
NODE="YOUR NODE NAME"
IFS=$'\n'
for line in $(curl -s 'localhost:9200/_cat/shards' | fgrep UNASSIGNED); do
INDEX=$(echo $line | (awk '{print $1}'))
SHARD=$(echo $line | (awk '{print $2}'))
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
@fforbeck
fforbeck / gist:43f3e946357a045a6cf3
Created January 20, 2016 16:49 — forked from duydo/elasticsearch_best_practices.txt
ElasticSearch - Index best practices from Shay Banon
If you want, I can try and help with pointers as to how to improve the indexing speed you get. Its quite easy to really increase it by using some simple guidelines, for example:
- Use create in the index API (assuming you can).
- Relax the real time aspect from 1 second to something a bit higher (index.engine.robin.refresh_interval).
- Increase the indexing buffer size (indices.memory.index_buffer_size), it defaults to the value 10% which is 10% of the heap.
- Increase the number of dirty operations that trigger automatic flush (so the translog won't get really big, even though its FS based) by setting index.translog.flush_threshold (defaults to 5000).
- Increase the memory allocated to elasticsearch node. By default its 1g.
- Start with a lower replica count (even 0), and then once the bulk loading is done, increate it to the value you want it to be using the update_settings API. This will improve things as possibly less shards will be allocated to each machine.
- Increase the number of machines you have so
// installed Clojure packages:
//
// * BracketHighlighter
// * lispindent
// * SublimeREPL
// * sublime-paredit
{
"word_separators": "/\\()\"',;!@$%^&|+=[]{}`~?",
"paredit_enabled": true,