Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
Chilling Out !!

Yash Sharma yashrsharma44

🤠
Chilling Out !!
View GitHub Profile
@yashrsharma44
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
http:
config:
- path: /api/v1/query
port: 10904
- path: apiv1/app_range/metrics
@yashrsharma44
yashrsharma44 / request_logging.yaml
Last active Dec 7, 2020
Dummy description of a yaml config file for request logging
View request_logging.yaml
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.
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)
View dfs_check_cycle.java
import java.util.*;
// Detect cycle in a directed graph
public class cycle
{
int V;
LinkedList<Integer> adj[];
public cycle(int v)
View snippet.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
@yashrsharma44
yashrsharma44 / README.md
Last active Mar 20, 2019
Code to Run the doc2vec conversion
View README.md

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 <input folder>
@yashrsharma44
yashrsharma44 / gist.md
Created Mar 17, 2019
Instructions to run the Summarizer
View gist.md

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 / OpenSoft.md
Last active Mar 13, 2019
Instructions to use summarizer
View OpenSoft.md

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
View documentation.md

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 / quotes.py
Created Jul 31, 2018
Sample spider for running the new asyncio support in scrapy
View quotes.py
import scrapy
from scrapy.Fetch import Fetch
import asyncio
import aiohttp
class QuotesSpider(scrapy.Spider):
name = "quotes"
async def start_requests(self):
urls = [