Skip to content

Instantly share code, notes, and snippets.

View varundey's full-sized avatar
🧼
Keep bugs and virus away

Varun Dey varundey

🧼
Keep bugs and virus away
View GitHub Profile
@varundey
varundey / indexing.py
Created April 8, 2016 13:22
indexing for elasticsearch
#!/usr/bin/env python
from elasticsearch import Elasticsearch
es = Elasticsearch()
import json
import os
x= os.listdir("/home/varun/Desktop/git/zeroclickinfo-goodies/share/goodie/cheat_sheets/json")
li=[]
for xx in x:
@varundey
varundey / rssCrawler.py
Created April 9, 2016 11:51
RSS news feed crawler
url = "http://timesofindia.indiatimes.com/rss.cms"
from bs4 import BeautifulSoup as bs
import requests
soup = bs(requests.get(url).content, "lxml")
soup = soup.findAll("table",{"border":"0", "width":"740", "cellspacing":"0", "cellpadding":'0'})
print len(soup)
dic = {}
file = open("newsrss.txt","a")
for i in soup:
def value(k, degree, coefficients):
ans = 0
for i in range(degree+1):
ans += coefficients[i]*pow(k,i)
return ans
degree = input()
coefficients = map(int,raw_input().split())
t=input()
#include <stdio.h>
#include <math.h>
void val(long long int k, long long int coeff[], long long int deg){
long long int ans=0,p;
for(int i=0;i<=deg;i++){
double ow = pow(k,i);
p = (int)ow;
ans+=coeff[i]*p;
printf("%lld",ans);
@varundey
varundey / app.py
Created July 8, 2016 21:03 — forked from rosner/app.py
Simple flask app with user login, registration based on twitters bootstrap
from flask import Flask, render_template
from flask.ext.security import SQLAlchemyUserDatastore, Security
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.bootstrap import Bootstrap
from flask_mail import Mail
from flask.ext.security import UserMixin, RoleMixin
app = Flask(__name__)
n=input()
arr=[]
while n!=0:
n-=1
arr.append(input())
m=input()
while m!=0:
m-=1
arr.append(input())
for i in sorted(arr):
@varundey
varundey / squdrun.py
Created November 5, 2016 16:23
Arranges list in negatives and positives and creates alternate of those numbers
a = map(int, raw_input().split())
def rearrange(li):
val = len(li)-1
for i in range(len(li)):
if li[i]>0 and i<mid:
while True:
if li[val]<0:
li[i], li[val] = li[val], li[i]
break

Keybase proof

I hereby claim:

  • I am varundey on github.
  • I am varundey (https://keybase.io/varundey) on keybase.
  • I have a public key ASCiQHGqH8_r9Qp8Om48zYLFjVeCYyhQRcO3i4o5WDj7ogo

To claim this, I am signing this object:

@varundey
varundey / about.md
Last active November 29, 2016 19:55
About me for PyCon Pune talk
  • Winter intern 2017 at Symantec Chennai
  • Backend Software Developer with significant Python experience as main stack
  • Loves automating things for the lazy developers humans
  • Built Google PageSpeed Insights Extension which gets humble thousand downloads per month
  • Built Semantic Search Engine on Wikipedia from the open source dumps provided by DBPedia
  • Developed a better implementation of DuckDuckGo's Zero Click Info Goodies cheatsheet which is much more extensible and doesn't break on simple queries
  • You can find all my online footprints and portfolio at my website
  • Find my open source projects on Github or find me on Linkedin
@varundey
varundey / fibonacci.py
Created March 10, 2017 07:37
Python program to print the nth fibonacci number
def memoize(f):
memo = {}
def helper(x):
if x not in memo:
memo[x] = f(x)
return memo[x]
return helper
@memoize
def fib(n):