Skip to content

Instantly share code, notes, and snippets.

View sauravtom's full-sized avatar
🏠
Working from home

Saurav Kumar sauravtom

🏠
Working from home
View GitHub Profile
@sauravtom
sauravtom / morningSpreadsheet.py
Last active November 29, 2019 15:35
Program to publish reddit data onto google spreadsheets
import gspread
from newspaper import Article
from bs4 import BeautifulSoup
import requests
import re
import time
import feedparser
# Login with your Google account
gc = gspread.login('megmailaccount', 'mepassword')
import requests
domain="zysten.net aok.de apotheke.de arthrose.de www.zuckerkuegelchen.de"
domains = domain.split(" ")
def main(domain):
url = "http://api.similarweb.com/Site/%s/v1/visits?gr=daily&start=9-2013&end=5-2014&md=true&Format=JSON&UserKey=16b3af1ddf135f22b90c0243fdfe3c2b"%domain
f = requests.get(url)
sum = 0
for i in f.json()['Values']:
@sauravtom
sauravtom / subreddit_array.py
Created September 16, 2014 18:48
Python script to generate a list of top 100 subreddits
#!/usr/bin/env python
import json
import requests
def main():
arr = requests.get("http://www.reddit.com/reddits.json?limit=1000").json()['data']['children']
arr = [i['data']['display_name'] for i in arr]
f=open('subreddits.json','w')
f.write(json.dumps(arr))
@sauravtom
sauravtom / ddos.py
Last active August 15, 2022 12:39
Analyzing a DDOS attack with python
#!/usr/bin/env python
import sys
import collections
import urllib
def main(date):
log_file = open('/var/log/auth.log', "r")
#creating an array of the ip of all items which contain date and the string "Failed password"
arr = [line.split(" ")[-4] for line in log_file if date in line and "Failed password" in line]
@sauravtom
sauravtom / news-orch.py
Created February 19, 2014 19:06
Source code for news orchin blog bot
#!/usr/bin/python
from gdata import service
import gdata
import atom
import getopt
import sys
from local_settings import email,password,blogid
import requests
@sauravtom
sauravtom / 9vine.py
Last active May 8, 2016 05:14
Scraper behind youtube channel 9vine http://youtu.be/G7Z__m02eFQ
from bs4 import BeautifulSoup
import urllib2
import urllib
import time
import datetime
import sys
import os
from local_settings import username, password
chanells = ['TheFunnyVines','vinehumor','ScienceVines','TheFunnyVine','The_Best_Vines','BestOfVines']
@sauravtom
sauravtom / lace1_solutions.txt
Created October 4, 2013 01:49
Solutions to lace1
Question 1
Fibonacci series are defined as the number in the following integer sequence 0,1,1,2,3,5,8,13,21,34,55,89,144 <br>
Let there be a function such that f(0,1) which generates the fibonacci series, where 0,1 are the first two terms of the fibonacci series.
such that f(4,5) will generate the following series 4,5,9,14,23,37,60 ... <br>
Find the 20th term of the series represented f(100,101)
ANS 1101365
Solution:
@sauravtom
sauravtom / foo.css
Last active December 16, 2015 05:59
iframe{
position:absolute;
top:0px;
bottom:0px;
}
@sauravtom
sauravtom / mangafox.js
Last active December 15, 2015 08:08
A better way to read mangafox.
script = document.createElement( 'script' );
script.src = 'http://code.jquery.com/jquery-1.9.1.js';
document.body.appendChild(script);
var all = document.getElementsByTagName("div");
var viewer = document.getElementById("viewer").style;
for (var i=0, max=all.length; i < max; i++) {
all[i].style.visibility='hidden';
@sauravtom
sauravtom / mangafox_bkmrlt.js
Created March 23, 2013 16:11
Simple bookmarklet to make reading mangas of mangafox less painful.V1
javascript: (function () {
var all = document.getElementsByTagName("div");
var viewer = document.getElementById("viewer").style;
for (var i=0, max=all.length; i < max; i++) {
all[i].style.visibility='hidden';
}
viewer.visibility='visible';
viewer.position='absolute';