Skip to content

Instantly share code, notes, and snippets.

View vaibhavgeek's full-sized avatar
🎯
Focusing

Vaibhav Maheshwari vaibhavgeek

🎯
Focusing
View GitHub Profile
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
#include <bits/stdc++.h>
using namespace std;
int main(){
long int t;
cin>>t;
while(t>0){
long long int c,d,l;
cin>>c>>d>>l;
long long int minl, maxl;
if(c < (2*d))
@vaibhavgeek
vaibhavgeek / sitemap.py
Created May 8, 2018 18:34
Crawl Website with multithreading functionalities
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
404.
A simple multithreaded dead link crawler.
"""
import os
@vaibhavgeek
vaibhavgeek / mlab.py
Last active April 7, 2018 11:32
MongoDB Client
from pymongo import MongoClient
CONNECTION = 'mongodb://abhishek:abhishek@ds143388.mlab.com:43388/intreader'
client = MongoClient(CONNECTION)
db = client.intreader
db.books.insert({"id": id , "book_name" : "name_of_the_book" , "pages" : "total_number_of_pages"})
previous_page = db.pages.find().sort('$natural', pymongo.DESCENDING).limit(-1).next()
pid = previous_page.id + 1
db.pages.insert({"id": id , "book_id" : "id" , "text" : "page_text" , "page_number": "p" })
@vaibhavgeek
vaibhavgeek / slash.py
Last active April 7, 2018 11:02
slashdot
import os
import pdftotext
from collections import defaultdict
# Load your PDF
def reader():
json = {}
with open("Resume.pdf", "rb") as f:
@vaibhavgeek
vaibhavgeek / download.py
Created December 22, 2017 12:28
Download large files from drive using terminal
import requests
def download_file_from_google_drive(id, destination):
def get_confirm_token(response):
for key, value in response.cookies.items():
if key.startswith('download_warning'):
return value
return None
<ul class="messages_admin">
<li class="message right appeared">
<div class="text_wrapper">
<div class="text">
What is Vedic Maths?
</div>
</div>
</li>
require 'net/http'
require 'json'
class Bots::VedicmathsController < ApplicationController
def show
@messages = Message.all
end
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_chat
identified_by :current_visitor
def connect
if cookies.signed['chat'] == nil
cookies.signed['chat'] = return_random_string
end
puts cookies.signed['chat']
puts "\n this is from connection.rb file"
@vaibhavgeek
vaibhavgeek / vaibhav.py
Created July 30, 2017 09:53
Vaibhav Agarwal Chatbot
#First way
#copy this console
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"greeting",
"greeting":{
"text":"Timeless apparel for the masses."
}
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
#second way