Skip to content

Instantly share code, notes, and snippets.

Chilling Out !!

Yash Sharma yashrsharma44

Chilling Out !!
View GitHub Profile
yashrsharma44 / config.yaml
Last active Sep 6, 2021
Final YAML config file for request logging in Thanos
View config.yaml
# 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
- path: /api/v1/query
port: 10904
- path: apiv1/app_range/metrics
yashrsharma44 / request_logging.yaml
Last active Dec 7, 2020
Dummy description of a yaml config file for request logging
View request_logging.yaml
- 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.
View articulation.cpp
#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)
import java.util.*;
// Detect cycle in a directed graph
public class cycle
int V;
LinkedList<Integer> adj[];
public cycle(int v)
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
key : str
Key to be inserted in the dictionary
value : str or None
Value to be inserted
yashrsharma44 /
Last active Mar 20, 2019
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
yashrsharma44 /
Created Mar 17, 2019
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 <input folder> <output folder>
yashrsharma44 /
Last active Mar 13, 2019
Instructions to use summarizer

Instructions to use RBM

  • First clone the following repository -
git clone
  • cd summarization/unsupervised/RBM
  • cd into the RBM folder
  • pip install -r requirements.txt
  • pip install scipy numpy nltk theano
  • pip install Image Pandas

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 /
Created Jul 31, 2018
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 = [