Skip to content

Instantly share code, notes, and snippets.

View dineshsonachalam's full-sized avatar
🌟
Per aspera ad astra

Dinesh Sonachalam dineshsonachalam

🌟
Per aspera ad astra
View GitHub Profile
import requests
import json
def check_if_index_is_present(url):
response = requests.request("GET", url, data="")
json_data = json.loads(response.text)
return json_data
if __name__ == "__main__":
from urllib.request import urlopen
from bs4 import BeautifulSoup
import requests,json,time
from random import randint
if __name__ == "__main__":
count = 1
website = "https://hackr.io/"
html_content = urlopen(website)
soup_data = BeautifulSoup(html_content, 'lxml')
from flask import Blueprint,render_template,request,jsonify
import requests,json
# creating a Blueprint class
search_blueprint = Blueprint('search',__name__,template_folder="templates")
search_term = ""
headers = {
'Content-Type': "application/json",
from flask import Flask
from routes.search import search_blueprint
app = Flask(__name__)
app.register_blueprint(search_blueprint)
if __name__ == "__main__":
app.run("0.0.0.0",port=8005,debug=False,threaded=True)
bind = "0.0.0.0:8005"
workers = 5
# Here we are creating an image for python alphine image.(https://hub.docker.com/r/library/python/)
FROM python:3
# Copying the requirements.txt first to leverage Docker cache
COPY ./requirements.txt /app/requirements.txt
# WORKDIR is nothing but current directory (cd app)
WORKDIR /app
sudo: required
services:
- docker
before_install:
- docker build -t dineshsonachalam/hacker:1.0.0 .
script:
#log in to docker CLI
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin
@dineshsonachalam
dineshsonachalam / es_simple_autocomplete_example_config.sh
Created January 16, 2019 10:45 — forked from justinvw/es_simple_autocomplete_example_config.sh
Simple ElasticSearch autocomplete example configuration. The 'autocomplete' functionality is accomplished by lowercasing, character folding and n-gram tokenization of a specific indexed field (in this case "city").
# Delete the possibly existing autocomplete test index
curl -X DELETE localhost:9200/autocomplete_test
# Put the config of the autocomplete index
curl -X PUT localhost:9200/autocomplete_test -d '
{
"settings" : {
"index" : {
"analysis" : {
"analyzer" : {
worker_processes 4;
events { worker_connections 1024; }
http {
sendfile on;
upstream app_hacker {
server hacker:8005;
}
version: '3'
services:
elasticsearch:
image: "elasticsearch:5"
networks:
- frontend
restart: always
volumes:
- ./ES_DATA:/usr/share/elasticsearch/data
environment: