Skip to content

Instantly share code, notes, and snippets.

View pavan538's full-sized avatar

Pavan Kumar pavan538

View GitHub Profile
@pavan538
pavan538 / solrMysqlSetup.md
Created July 31, 2019 08:45 — forked from rnjailamba/solrMysqlSetup.md
Solr + Mysql + Data Import Handler + Delta Import Handler [ Version 5.5.0 of solr ]
@pavan538
pavan538 / 00. tutorial.md
Created July 31, 2019 08:45 — forked from maxivak/00. tutorial.md
Importing/Indexing database (MySQL or SQL Server) in Solr using Data Import Handler
<form action="{{ action }}"  name="payuForm" method="post">    
    {% csrf_token %}        
    <input type="hidden" name="key" value="{{ key }}" />            
    <input type="hidden" name="hash" value="{{ hash }}"/>            
    <input type="hidden" name="txnid" value="{{ txnid }}" />
    <input type="hidden" name="amount" value="{{ amount }}" />
    <input type="hidden" name="email" value="{{ email }}" />
    <input type="hidden" name="firstname" value="{{ firstname }}" />
    <input type="hidden" name="phone" value="{{ phone }}" />
@pavan538
pavan538 / async_aiohttp.py
Created July 15, 2019 07:11
Asynchronous aiohttp responses.
import asyncio # only here for debugging purposes
import aiohttp
USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:61.0) Gecko/20100101 Firefox/61.1'
def default_headers():
header = {
'User-Agent': USER_AGENT
}
@pavan538
pavan538 / http_streaming.md
Created June 25, 2019 12:02 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@pavan538
pavan538 / fpcursorpagination.py
Created June 6, 2019 06:42 — forked from keturn/fpcursorpagination.py
test for CursorPagination with floating point field
class FloatingPointCursorPagination(CursorPagination):
__rounding_down = decimal.Context(prec=14, rounding=decimal.ROUND_FLOOR)
__rounding_up = decimal.Context(prec=14, rounding=decimal.ROUND_CEILING)
def _get_position_from_instance(self, instance, ordering):
field_name = ordering[0].lstrip('-')
if isinstance(instance, dict):
attr = instance[field_name]
else:
attr = getattr(instance, field_name)
@pavan538
pavan538 / .gitignore
Created May 27, 2019 11:10 — forked from akaihola/.gitignore
streaming-json-encoder
*.pyc
/bin
/include
/lib
@pavan538
pavan538 / git_cheatsheet.md
Last active April 26, 2019 02:21
Git cheat sheet

Git untrack the file

The series of commands below will remove all of the items from the Git Index (not from the working directory or local repo), and then updates the Git Index, while respecting git ignores. PS. Index = Cache

First:

git rm -r --cached . 
git add .
@pavan538
pavan538 / TestUnionEvolution.java
Created April 9, 2019 16:46 — forked from ept/TestUnionEvolution.java
Adding a new branch to an Avro union
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.generic.GenericDatumWriter;
import org.apache.avro.generic.GenericRecordBuilder;
import org.apache.avro.io.BinaryDecoder;
import org.apache.avro.io.BinaryEncoder;
import org.apache.avro.io.DatumReader;
@pavan538
pavan538 / cbv_multiple_forms.html
Created April 4, 2019 17:55 — forked from badri/cbv_multiple_forms.html
Django multiple forms code with sample usage
{% extends "base.html" %}
{% block content %}
<form method="post">{% csrf_token %}
{{ forms.subscription }}
<input type="submit" value="Subscribe">
</form>
<form method="post">{% csrf_token %}
{{ forms.contact }}
<input type="submit" value="Send">