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 / 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
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']:
def remove_tags(s):
li=[]
for i in range(len(s)):
b=s.find('>',i)
e=s.find('<',b+1)
p=s[b+1:e]
if len(p)!=0 :
li.append(p)
for e in range(0,len(li)-1,1):
def do_it(x,y,z):
# To Do : for x in z: replace x by y,again and again
# 1st step: if x appears in z
# 2nd step: then replce x by y
for i in range(len(z)-3):
if z[i:i+3]==x: # I cannot understand why this is not working , I set
z=z[:i]+y+z[i+3:] # the condition that if x is in z then modify z as follows
i=0 # and then I set i as 0 , and go over the loop again,
@sauravtom
sauravtom / Annoy.bat
Created June 7, 2012 04:39
Simple batch file program that displays a list of messages and then goes to loop.
@echo off
title Ok so get ready to be annoyed,
:annoy
msg * Hello %username%, I am Saurav
msg * How are you %username%?
msg * I am fine.
msg * .......
msg * this is a whale , '____________________________'
msg * I hope this annoying string of messages finds you in the best of your health.
msg * Since this is one way conversation, almost all of the talking will be done by me only.
@sauravtom
sauravtom / app.yaml
Created June 26, 2012 15:04
Appspot
import webapp2
form = """
<form title="Google Something" align = "center" action = "http://www.google.com/search" target="_blank">
<input name = "q"> <input type = "submit" value="Google search">
</form>
<br>
<form title="Search something on Duck Duck go" align = "center" action = "http://www.duckduckgo.com/search" target="_blank">
<input name = "q"> <input type = "submit" value="DuckDuckGo search">
</form>
Verifying that +sauravtom is my blockchain ID. https://onename.com/sauravtom
@sauravtom
sauravtom / url.html
Created December 31, 2012 10:21
url database
<html>
<head>
<title>Firebase Chat Example</title>
<script type="text/javascript" src="https://cdn.firebase.com/v0/firebase.js"></script>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
</head>
<body>
<input type='text' id='nameInput' placeholder="Your Url">
mkdir my_new_project
cd my_new_project
git init
git checkout --orphan gh-pages
touch index.html
touch README.md
gedit index.html //open index.html and edit the homepage
git add .
git commit -a -m 'First Version'
git remote add origin https://github.com/<username>/<projectname>.git
@sauravtom
sauravtom / tweet.py
Created January 10, 2013 07:51
Fetch tweet of a given username in command line
import urllib2
import json
def get_tweets(name):
s = urllib2.urlopen("http://search.twitter.com/search.json?q="+name).read()
x = json.loads(s)
for i in range(len(x['results'])):
print "%s.%s--> %s\n" %(i, x['results'][i]['from_user_name'], x['results'][i]['text'])
name = raw_input("Enter the twitter-username get recent tweets: ")