Skip to content

Instantly share code, notes, and snippets.

View ishara's full-sized avatar

Ishara Samantha ishara

View GitHub Profile
@ishara
ishara / filter-gallery.js
Created September 24, 2017 17:31 — forked from akshaynagpal/filter-gallery.js
Filter Gallery using HTML5, JavaScript, JQuery & Bootstrap Demo: https://jsbin.com/jeyadac
@ishara
ishara / gist:3d742240d8cafe491fd5e68e3288db95
Created August 30, 2017 09:52 — forked from andreia/gist:3354204
ORACLE: Show size in Kb of BLOB fields
SELECT round(DBMS_LOB.getlength(A.FILE)/1024) KB FROM MY_TABLE A
@ishara
ishara / spring-oauth-oracle-schema.sql
Created May 5, 2017 13:27
spring oauth oracle schema
create table oauth_client_details (
client_id VARCHAR(256) PRIMARY KEY,
resource_ids VARCHAR(256),
client_secret VARCHAR(256),
scope VARCHAR(256),
authorized_grant_types VARCHAR(256),
web_server_redirect_uri VARCHAR(256),
authorities VARCHAR(256),
access_token_validity INTEGER,
refresh_token_validity INTEGER,
@ishara
ishara / .gitignore
Created June 23, 2016 12:47 — forked from karmi/.gitignore
Example Nginx configurations for Elasticsearch
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@ishara
ishara / elasticsearch.md
Last active September 15, 2015 06:02 — forked from nicolashery/elasticsearch.md
Elasticsearch: updating the mappings and settings of an existing index

Elasticsearch: updating the mappings and settings of an existing index

Note: This was written using elasticsearch 0.9.

Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:

$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
  "_id": 1,
@ishara
ishara / gist:ed76d12c2f3aedf0e271
Last active September 14, 2015 13:32 — 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
@ishara
ishara / esSetup.sh
Last active September 1, 2015 13:49
Setup elasticsearch on CentOS
#!/bin/bash
# Script used to setup elasticsearch. Can be run as a regular user (needs sudo)
ES_USER="elasticsearch"
ES_GROUP="$ES_USER"
ES_HOME="/usr/local/share/elasticsearch"
ES_CLUSTER="clustername"
ES_DATA_PATH="/var/data/elasticsearch"
ES_LOG_PATH="/var/log/elasticsearch"
ES_HEAP_SIZE=1024
package com.willvuong.foodie.controller;
import com.willvuong.foodie.dao.PlaceRepository;
import com.willvuong.foodie.domain.Place;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ishara
ishara / gist:97651e9199bbed038bb2
Created July 30, 2014 19:55
Elasticsearch query with groovy script
GET /my_data/data_type/_search
{
"query": {
"function_score": {
"query": {
"range": {
"yearopened": {
"gte": 2000
}
@ishara
ishara / RetryConsumer
Created June 12, 2014 18:51
ActiveMQ Retry Consumer Example
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.transport.TransportListener;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.Session;