Skip to content

Instantly share code, notes, and snippets.

View yagyanshbhatia's full-sized avatar
:octocat:
I love coding!

Yagyansh Bhatia yagyanshbhatia

:octocat:
I love coding!
View GitHub Profile
@yagyanshbhatia
yagyanshbhatia / index.js
Last active April 4, 2019 20:14
Sample Suggestion chips implementation
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
const { Carousel, Image, Suggestions } = require('actions-on-google');
process.env.DEBUG = 'dialogflow:debug';
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
@yagyanshbhatia
yagyanshbhatia / Index.js
Created March 30, 2019 10:14
Carousel cards pseudo implementation prototype for internet archive's assistant.
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
const { Carousel, Image } = require('actions-on-google');
process.env.DEBUG = 'dialogflow:debug';
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
@yagyanshbhatia
yagyanshbhatia / index.js
Created March 30, 2019 06:29
BasicCard template (prototype) for the wayback machine's google assistant.
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
const { Carousel, Image, Button, BasicCard } = require('actions-on-google');
process.env.DEBUG = 'dialogflow:debug';
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
@yagyanshbhatia
yagyanshbhatia / Checker.py
Last active June 28, 2018 16:35
Tired of checking repeatedly for rating on codeforces to change? why not automate it with this script B)
from urllib.request import urlopen
import urllib
from bs4 import BeautifulSoup
import time
import pymsgbox
#taking the required variables
print("what is your current rating? ")
curr = str(input())
print("Enter your username: ")
@yagyanshbhatia
yagyanshbhatia / solution_downloader.py
Last active March 27, 2018 17:37
A simple python script to download chapter wise solutions to the CLRS book for algorithms :)
import urllib.request
import shutil
for i in range(34):
url = "http://sites.math.rutgers.edu/~ajl213/CLRS/Ch" + str(i+1) +".pdf"
output_file = "LOCATION WHERE YOU WANT TO DOWNLOAD/" + str(i+1) + ".pdf"
with urllib.request.urlopen(url) as response, open(output_file, 'wb') as out_file:
shutil.copyfileobj(response, out_file)
@yagyanshbhatia
yagyanshbhatia / crc32.py
Created March 24, 2018 19:00
script to get the crc32 checksum of a zip file.
import zlib
def crc32(fileName):
prev = 0
for eachLine in open(fileName,"rb"):
prev = zlib.crc32(eachLine, prev)
return "%X"%(prev & 0xFFFFFFFF)
print(crc32("plugin.zip"))
@yagyanshbhatia
yagyanshbhatia / sample.py
Last active March 22, 2018 22:44
sample of how the generic class will be
#system uses duck architechture for maximum flexibility
class PicardPluginRegistry(type):
plugins = []
def __init__(cls, name, bases, atrrs):
if name!='PicardPlugin':
PicardPluginRegistry.plugins.append(cls)
class PicardPlugin(object):