Skip to content

Instantly share code, notes, and snippets.

View yashrsharma44's full-sized avatar

Yash Sharma yashrsharma44

View GitHub Profile
@yashrsharma44
yashrsharma44 / quotes.py
Created July 31, 2018 14:43
Sample spider for running the new asyncio support in scrapy
import scrapy
from scrapy.Fetch import Fetch
import asyncio
import aiohttp
class QuotesSpider(scrapy.Spider):
name = "quotes"
async def start_requests(self):
urls = [

Using new asyncio support in Scrapy

This gist lists up the use case and details of using asyncio support in Scrapy

Requirements of the installation

  1. Use Python3.7.
  2. Install asyncio,using pip install asyncio.
  3. If you plan to use any asyncio framework, then install them also. For example, for using aiohttp,install pip install aiohttp.
  4. Due to a bug in Twisted, one has to use the developer version of Twisted. Use this github page to clone Twisted in another folder.
@yashrsharma44
yashrsharma44 / OpenSoft.md
Last active March 13, 2019 14:28
Instructions to use summarizer

Instructions to use RBM

  • First clone the following repository -
git clone https://github.com/Law-AI/summarization.git
  • cd summarization/unsupervised/RBM
  • cd into the RBM folder
  • pip install -r requirements.txt
  • pip install scipy numpy nltk theano
  • pip install Image Pandas
@yashrsharma44
yashrsharma44 / gist.md
Created March 17, 2019 09:52
Instructions to run the Summarizer

Instructions to run the summarizer for Case files

  • Note that we are using the original case files as input, and not the summarized files as input, because the result with the summarized files are gibberish

Steps to run the summarizer

  • We are using Python2.7
  • pip install gensim
  • python sum100.py <input folder> <output folder>
@yashrsharma44
yashrsharma44 / README.md
Last active March 20, 2019 18:55
Code to Run the doc2vec conversion

Code to run the doc2vec conversion

Taken from Gensim Tutorial

Steps to run the code -

  • Download the attachment
  • Make sure python is installed
  • Type pip install gensim nltk
  • If any library is missing, install them as pip install <library_name>
  • Run python code_runner.py
def _insert_in_metadata_fits_safe(meta, key, value):
"""Helper function to insert key-value pair into metadata in a way that
FITS can serialize
Parameters
----------
key : str
Key to be inserted in the dictionary
value : str or None
Value to be inserted
Notes
import java.util.*;
// Detect cycle in a directed graph
public class cycle
{
int V;
LinkedList<Integer> adj[];
public cycle(int v)
#include <bits/stdc++.h>
#define MAX_VAL 40000
using namespace std;
/*
Code for calculation of articulation point and bridges
We use dp array for calculating the back edges over u(parent) -> v(child) edge
dp[u] = # back-edge going up + # back-edge going down - Sum of dp[child] where child-> child of u(i.e. v)
@yashrsharma44
yashrsharma44 / request_logging.yaml
Last active December 7, 2020 05:44
Dummy description of a yaml config file for request logging
request_logging:
- http:
- config:
- path: # regexp “*” e.g /api/v1/query_range or /metrics
port: # int
- path: # regexp “*” e.g /api/v1/query_range or /metrics
port: # int
- options: # We configure the options for this indvidual path
- level: # INFO / DEBUG / WARN / ERROR -> means what messages with certain log level will be printed.
@yashrsharma44
yashrsharma44 / config.yaml
Last active September 6, 2021 09:48
Final YAML config file for request logging in Thanos
# Dummy Configuration file for Request Logging in Thanos.
# The options field can be added individually for http/grpc.
# If you want to add config for both grpc/http, indent the config field at the same level of http/grpc
http:
config:
- path: /api/v1/query
port: 10904
- path: apiv1/app_range/metrics