Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
curl -XPOST 'localhost:9200/coupon/_search?pretty' -H 'Content-Type: application/json' -d'
{
"query": {
"bool": {
"should": [
{"match": {"sponsor": {"query": "rent car in Bangalore"} } },
{"match": {"title": {"query": "rent car in Bangalore"} } },
{"match": {"description": {"query": "rent car in Bangalore"} } } ] }
@yogeshsr
yogeshsr / coupons_index_mapping_partial.json
Created March 10, 2018 13:13
Partial coupons index mapping
{
"dynamic": false,
"properties": {
"id": {
"type": "keyword"
},
"sponsor": {
"type": "text",
"term_vector": "yes",
"analyzer": "coupon_analyzer_basic",
@yogeshsr
yogeshsr / coupon-index-settings.json
Created March 10, 2018 08:32
Couper index settings
{
"mappings": {
"doc": {
"dynamic": false,
"properties": {
"id": {
"type": "keyword"
},
"sponsor": {
"type": "text",
@yogeshsr
yogeshsr / all-coupons.json
Last active March 10, 2018 08:26
All Coupons data
[
{
"id": "dcaf7d50-b6d1-413b-b52f-36d0288013e2",
"sponsor": "ZoomCar",
"title": "GrabOn - ZoomCar WeekEnd Exclusive Offer: Flat 20% Off On Self Drives (All Days)",
"description": "Verified on 10 Mar 2018. This Festive Season Zoomcar brings an amazing discount of 20% on your bookings. The maximum discount is Rs 1000. This offer is available in all serviceable cities. Zoomcar is an online service providing car rental for self driven cars across India. Book self drive cars at just on go. The offer is active in: Bangalore, Pune, Delhi, Chennai, Hyderabad, Chandigarh, Kolkata, Ahmedabad, Mysore, Vizag, Jaipur, Mangalore, Coimbatore, and Ludhiana. The discount is only applicable only on original reservation charges (not applicable on excess Km, late return fee, or other fees/charges). A fully refundable security deposit will be charged at the time of booking. Only valid on bookings made through Zoomcar website."
},
{
"id": "4cc6357a-242f-11e8-b467-0ed5f89f718b",
"sponsor": "MakeMyTrip
@yogeshsr
yogeshsr / coupon-sample.json
Created March 10, 2018 06:12
Coupon Samle
{
"id": "dcaf7d50-b6d1-413b-b52f-36d0288013e2",
"sponsor": "Coca-Cola",
"title": "GrabOn - ZoomCar WeekEnd Exclusive Offer: Flat 20% Off On Self Drives (All Days)",
"description": "Verified on 10 Mar 2018. This Festive Season Zoomcar brings an amazing discount of 20% on your bookings. The maximum discount is Rs 1000. This offer is available in all serviceable cities. Zoomcar is an online service providing car rental for self driven cars across India. Book self drive cars at just on go. The offer is active in: Bangalore, Pune, Delhi, Chennai, Hyderabad, Chandigarh, Kolkata, Ahmedabad, Mysore, Vizag, Jaipur, Mangalore, Coimbatore, and Ludhiana. The discount is only applicable only on original reservation charges (not applicable on excess Km, late return fee, or other fees/charges). A fully refundable security deposit will be charged at the time of booking. Only valid on bookings made through Zoomcar website."
}
@yogeshsr
yogeshsr / reflect.py
Created January 3, 2018 12:50 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@yogeshsr
yogeshsr / docker-cleanup-resources.md
Created December 29, 2017 06:54 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@yogeshsr
yogeshsr / gist:3fb71e38e7a06d0d3383
Last active August 29, 2015 14:05
Online file picker
define( [ 'jquery', 'enketo-js/Widget' ], function( $, Widget ) {
"use strict";
var pluginName = 'offlineFilepicker';
/**
* Loop through $('form.or input[type="file"]') during submission submit.
*
*
* @constructor