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 / shurl.py
Created March 14, 2013 14:31
Goo.gl url shortening wrapper for python
#!/usr/bin/python
from sys import argv
import httplib2
import simplejson as json
#API_KEY = ADD YOUR API KEY HERE , even if you don't shurl will still work
def shurl(longUrl):
@sauravtom
sauravtom / foo.py
Last active December 14, 2015 12:59
My solution python challenge 1 http://www.pythonchallenge.com/pc/def/map.html
text ='''g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.'''
def trans(string):
poop=''
for i in string:
#if i in ['.' , ',' , ')' , '(' , "'"," "]: #dont translate special characters
if in in " .,'():;":
poop+=i
else:
@sauravtom
sauravtom / bkmt.js
Created March 2, 2013 03:15
Bookmarktlet that is supposed to download vimeo video, but doesn't work.and i know why.
javascript: (function () {
var vim_id = document.URL.substring(17);
var url = 'http://player.vimeo.com/play_redirect?quality=hd&codecs=h264&clip_id='
+vim_id+
'&time=1362143485&sig=e846af3c50137c059ea2099a220a1f8b&type=html5_desktop_local';
saveToDisk(url, document.URL+'.mp4');
console.log(url);
function saveToDisk(fileUrl, fileName) {
var save = document.createElement("a");
@sauravtom
sauravtom / set_int_fib.html
Created February 13, 2013 04:04
Example of set time interval : Continously print fibonacci numbers on the screen
<!doctype html>
<html lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
<title>Sauraxe</title>
<style type="text/css">
#x{
//text-align:center;
font-size:10px;
font-family:‘American Typewriter’, ‘Courier New’, Courier, Monaco, mono;
@sauravtom
sauravtom / workflow.txt
Last active December 12, 2015 03:28
Making a web scraper in python
#-------------------------------------------------------
import urllib2
import json as simplejson
response = urllib2.urlopen('https://twitter.com/')
html=response.read()
print html
@sauravtom
sauravtom / wtf.txt
Created January 27, 2013 17:49
YQL Search string
YQL search string,
encodeURIComponent
http://query.yahooapis.com/v1/public/streaming/yql?q=
select%20*%20from%20html%20where%20url%3D%22https%3A%2F%2Ftwitter.com%2Fsearch%2Frealtime%3Fq%3Dvine.co%252Fv%252F%2B%252B%2Bmom%26src%3Dtypd%22
@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",
@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 / 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: ")
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