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
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>
@sauravtom
sauravtom / php_grabber.php
Created October 4, 2012 05:09
An image grabber php script which crawls the entered url and comes up with a list of all links on the page and displays them beautifully on the page. Uses simple html dom , which makes it all cake walk. <contains 3 files php_grabber.php ,simple_html_dom.
<html>
<head>
<title>Image Grab</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link href='http://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
$("#toggle").click(function() { $("img").slidetoggle("slow"); };
</script>
@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: ")
@sauravtom
sauravtom / index.html
Created January 22, 2013 09:01
A CodePen by Rafał Krupiński.
<canvas id="c" width="400" height="400"></canvas>
@sauravtom
sauravtom / chromeapp.txt
Last active December 11, 2015 17:08
Chrome app notes
Opening up a new tab with chrome app
------------------------------------
manifest.json
{
"name": "Alyssa",
"version": "2.0",
"manifest_version": 2,
"description": "Alyssa app",