Tag Archive for google

Google calendar embed

<iframe src="http://www.google.com/calendar/embed?height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=GOOGLE_EMAIL_ADDRESS%40gmail.com&amp;color=%232952A3&amp;ctz=America%2FNew_York" style=" border-width:0 " width="800" height="600" frameborder="0" scrolling="no"></iframe>

source

Scrape Google from the command line

perl -e "$i=0;while($i<1000){sleep 1; open(WGET,qq/|xargs lynx -dump/);printf WGET qq{http://www.google.com/search?q=site:onemorebug.com&hl=en&start=$i&sa=N},$i+=10}" | grep "//[^/]*onemorebug.com/"

source

currency changer with google

<script type="text/javascript">

function callGoogle(){

var form=document.getElementById("Gform");
var link="http://www.google.hu/search?q="+form.elements["value"].value+"+"+form.elements["from"].value+"+to+"+form.elements["to"].value;
location.href=link;

}

</script>

<form id="Gform">

<input type="text" name="value" size="6">

<select name="from">
<option>EUR
<option>HUF
<option>GBP
<option>AUD
<option>CZK
<option>DKK
<option>JPY
<option>CAD
<option>PLN
<option>NOK
<option>CHF
<option>SEK
<option>SKK
<option>USD
</select>

TO

<select name="to">
<option>HUF
<option>GBP
<option>AUD
<option>CZK
<option>DKK
<option>EUR
<option>JPY
<option>CAD
<option>PLN
<option>NOK
<option>CHF
<option>SEK
<option>SKK
<option>USD
</select>

<input type="button" onclick="callGoogle()" value="Change!">

</form>

source

currency changer with google

<script type="text/javascript">

function callGoogle(){

var form=document.getElementById("Gform");
var link="http://www.google.hu/search?q="+form.elements["value"].value+"+"+form.elements["from"].value+"+to+"+form.elements["to"].value;
location.href=link;

}

</script>

<form id="Gform">

<input type="text" name="value" size="6">

<select name="from">
<option>EUR
<option>HUF
<option>GBP
<option>AUD
<option>CZK
<option>DKK
<option>JPY
<option>CAD
<option>PLN
<option>NOK
<option>CHF
<option>SEK
<option>SKK
<option>USD
</select>

TO

<select name="to">
<option>HUF
<option>GBP
<option>AUD
<option>CZK
<option>DKK
<option>EUR
<option>JPY
<option>CAD
<option>PLN
<option>NOK
<option>CHF
<option>SEK
<option>SKK
<option>USD
</select>

<input type="button" onclick="callGoogle()" value="Change!">

</form>

source

301 Redirect Google Safe

header("HTTP/1.1 301 Moved Permanently");
header("Location: <a href="http://www.newdomain.com/somepage.html"" >http://www.newdomain.com/somepage.html"</a>);

source

Remove Google Notebook text

#gnotes-statusbar-lbl {
display: none !important;
}

source

AppleSearch on your Website

<!-- Google CSE Search Box Begins -->
<form id="searchbox_009486749950716717919:edzcv6gfaeg" action="http://www.filippocorti.com/pages/page2/mac/result/">
<input type="hidden" name="cx" value="009486749950716717919:edzcv6gfaeg" />
<input name="q" type="text" size="40" />
<input type="submit" name="sa" value="Apple Search" />
<input type="hidden" name="cof" value="FORID:11" />
</form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_009486749950716717919%3Aedzcv6gfaeg"></script>
<!-- Google CSE Search Box Ends -->

source

OPML PopUp to ease Podcast Aggregation

/* 'Get Podcasts'
* if isOPML is false, it pops up an escaped version in HTML.
* if isOPML is true, it pops up an OPML version.
* Either way, you need to copy and save the results as a file with an .opml extension
* You can then add it to your Aggregator of choice:
*/

var isOPML=false;
var entry=document.getElementById('entry-14040355');
var ul=entry.getElementsByTagName('ul')[1];
var links=ul.getElementsByTagName('a');
var smalls=entry.getElementsByTagName('small');
var names=[];var cond=false;var text=url=title="";
for(var i=0;i<smalls.length;++i){
cond=false;text=smalls[i].childNodes[0].nodeValue;
for(var j=0;j<names.length;++j){
if(text==names[j]){
cond=true;
}
}
if(!cond){
names.push(text);
}
}
//So far, names=["Purdue University","Southwest Tech","Berkeley","College of St. Scholastica","John Hopkins University","UCLA","Western Kentucky University","College of DuPage","NC State University","City University of New York","Ohio State University"];
function filter(name){
var t=output="";
for(var k=0;k<links.length;++k){
t=smalls[k].childNodes[0].nodeValue;
if(t==name){
url=links[k].href;
title=links[k].childNodes[0].nodeValue;
output=output+'			<outline text="'+title+'" title="'+title+'" type="rss" xmlUrl="'+url+'" htmlUrl="'+url+'"/>'+"
";
}
}
return output;
}
var header='<opml version="1.0">'+"
"+'	<head>'+"
"+'		<title>Free Academic Podcasts</title>'+"
"+'	</head>'+"
"+'	<body>'+"
";
var body='';
names.sort();
var p='Choose from which university you would like to get the podcasts from:
0. All';
for(var l=0;l<names.length;++l){
p=p+'
'+(l+1)+'. '+names[l];
}
var reply=prompt(p,"");
var choice=parseInt(reply)-1;
if(choice<0||choice>names.length-1||isNaN(choice)){
for(var l=0;l<names.length;++l){
body=body+'		<outline title="'+names[l]+'" text="'+names[l]+'">'+"
"+filter(names[l])+'		</outline>'+"
";
}
}else{
body='		<outline title="'+names[choice]+'" text="'+names[choice]+'">'+"
"+filter(names[choice])+'		</outline>'+"
";
}
body=body.replace(/="s/g,'="');
body=body.replace(/&/g,'&amp;');
var footer='	</body>'+"
"+'</opml>';
var htmlHeader='<html><head><title>Free Academic Podcasts</title></head><body>';
var htmlFooter='</body></html>';
var opml=(isOPML)?header+body+footer:htmlHeader+(((((header+body+footer).replace(/&/g,'&amp;')).replace(/>/g,'&gt;')).replace(/</g,'&lt;')).replace(/
/g,'<br>
'))+htmlFooter;
function popOPML(code){
var gOPML=window.open('','Free Academic Podcasts','top=300,left=200,height=480,width=640');
var tmp=gOPML.document;
tmp.open();
tmp.write(code);
tmp.close();
}
popOPML(opml);

/*Resulting Bookmarklet:*/
/*javascript:(function(){var%20isOPML=false;var%20entry=document.getElementById('entry-14040355');var%20ul=entry.getElementsByTagName('ul')[1];var%20links=ul.getElementsByTagName('a');var%20smalls=entry.getElementsByTagName('small');var%20names=[];var%20cond=false;var%20text=url=title='';for(var%20i=0;i&lt;smalls.length;++i){cond=false;text=smalls[i].childNodes[0].nodeValue;for(var%20j=0;j&lt;names.length;++j){if(text==names[j]){cond=true}}if(!cond){names.push(text)}}function%20filter(name){var%20t=output='';for(var%20k=0;k&lt;links.length;++k){t=smalls[k].childNodes[0].nodeValue;if(t==name){url=links[k].href;title=links[k].childNodes[0].nodeValue;output=output+'			&lt;outline%20text=%22'+title+'%22%20title=%22'+title+'%22%20type=%22rss%22%20xmlUrl=%22'+url+'%22%20htmlUrl=%22'+url+'%22/&gt;'+%22
%22}}return%20output}var%20header='&lt;opml%20version=%221.0%22&gt;'+%22
%22+'	&lt;head&gt;'+%22
%22+'		&lt;title&gt;Free%20Academic%20Podcasts&lt;/title&gt;'+%22
%22+'	&lt;/head&gt;'+%22
%22+'	&lt;body&gt;'+%22
%22;var%20body='';names.sort();var%20p='Choose%20from%20which%20university%20you%20would%20like%20to%20get%20the%20podcasts%20from:
%200.%20All';for(var%20l=0;l&lt;names.length;++l){p=p+'
%20'+(l+1)+'.%20'+names[l];}var%20reply=prompt(p,%22%22);var%20choice=parseInt(reply)-1;if(choice&lt;0||choice&gt;names.length-1||isNaN(choice)){for(var%20l=0;l&lt;names.length;++l){body=body+'		&lt;outline%20title=%22'+names[l]+'%22%20text=%22'+names[l]+'%22&gt;'+%22
%22+filter(names[l])+'		&lt;/outline&gt;'+%22
%22;}}else{body='		&lt;outline%20title=%22'+names[choice]+'%22%20text=%22'+names[choice]+'%22&gt;'+%22
%22+filter(names[choice])+'		&lt;/outline&gt;'+%22
%22;}var%20tx='='+'%22';body=body.replace(/=%22s/g,tx);body=body.replace(/&amp;/g,'&amp;amp;');var%20footer='	&lt;/body&gt;'+%22
%22+'&lt;/opml&gt;';var%20htmlHeader='&lt;html&gt;&lt;head&gt;&lt;title&gt;Free%20Academic%20Podcasts&lt;/title&gt;&lt;/head&gt;&lt;body&gt;';var%20htmlFooter='&lt;/body&gt;&lt;/html&gt;';var%20opml=(isOPML)?header+body+footer:htmlHeader+(((((header+body+footer).replace(/&amp;/g,'&amp;amp;')).replace(/&gt;/g,'&amp;gt;')).replace(/&lt;/g,'&amp;lt;')).replace(/
/g,'&lt;br&gt;
'))+htmlFooter;function%20popOPML(code){var%20gOPML=window.open('','Free%20Academic%20Podcasts','top=300,left=200,height=480,width=640');var%20tmp=gOPML.document;tmp.open();tmp.write(code);tmp.close()}popOPML(opml);})()*/

source

Python – randomFlickr

import os
import random
import re
import urllib
import urllib2

class flickrImages(object):

RE_IMAGEURL = re.compile('src="(http://static.flickr.com/.+?_t.jpg)"', re.DOTALL | re.IGNORECASE)

def __init__(self):

self.imagesURLs = {}

def getRandomImages(self):
'''
Scarica dal sito FlickrImages delle immagini in maniera random...
'''

htmlPage = ''
request = ''

requestURL = 'http://flickr.com/photos?start=%d' % (random.randint(0, 5000))
requestHeaders = {'User-Agent':'flickrImages/1.0'}

try:
request = urllib2.Request(requestURL, None, requestHeaders)
htmlPage = urllib2.urlopen(request).read(500000)
except:
pass

results = flickrImages.RE_IMAGEURL.findall(htmlPage)

if len(results) > 0:
for image in results:
imageURL = urllib.unquote_plus(image)
if not imageURL.startswith('http://'): imageURL = 'http://'+imageURL
imageURL = imageURL.replace('_t.jpg', '_o.jpg') # Prende il formato piu' grande
self.imagesURLs[imageURL] = 0

def downloadImages(self):
'''
Scarica nella cartella googleIMGs le foto che vengono trovate in rete...
'''

numberIMGs = len(self.imagesURLs)
posIMGs = 1

for imageName in self.imagesURLs:
print '[' + str(posIMGs) + '/' + str(numberIMGs) + '] - ' + imageName
urllib.urlretrieve(imageName, 'flickrIMGs' + os.sep + os.path.split(imageName)[1])
posIMGs += 1

if __name__ == '__main__':

test = flickrImages()

test.getRandomImages()
test.downloadImages()

print 'Finito...'

source

Python – randomGoogle

import os
import random
import re
import urllib
import urllib2

class googleImages(object):

RE_IMAGEURL = re.compile('imgurl=(http://.+?)&', re.DOTALL | re.IGNORECASE)

def __init__(self):

self.imagesURLs = {}

def getRandomImages(self, imageName=None):
'''
imageName = Nome dell'immagine da cercare, se non impostato viene generato un nome Random

Scarica dal sito GoogleImages delle immagini in maniera random...
'''

htmlPage = ''
request = ''

if imageName == None: imageName = self._randomWords()

requestURL = 'http://images.google.it/images?q=%s&hl=it&start=%d' % (imageName, (random.randint(0, 50)*10))
requestHeaders = {'User-Agent':'googleImages/1.0'}

try:
request = urllib2.Request(requestURL, None, requestHeaders)
htmlPage = urllib2.urlopen(request).read(500000)
except:
pass

results = googleImages.RE_IMAGEURL.findall(htmlPage)

if len(results) > 0:
for image in results:
imageURL = urllib.unquote_plus(image)
if not imageURL.startswith('http://'): imageURL = 'http://'+imageURL
self.imagesURLs[imageURL] = 0

def _randomWords(self):
'''
Viene generata una parola in maniera Random...
'''

words = ''
charset = 'abcdefghijklmnopqrtuvwxyz'*2 + '0123456789'

for i in range(random.randint(2, 7)): words += random.choice(charset)

return words

def downloadImages(self):
'''
Scarica nella cartella googleIMGs le foto che vengono trovate in rete...
'''

numberIMGs = len(self.imagesURLs)
posIMGs = 1

for imageName in self.imagesURLs:
print '[' + str(posIMGs) + '/' + str(numberIMGs) + '] - ' + imageName
urllib.urlretrieve(imageName, 'googleIMGs' + os.sep + os.path.split(imageName)[1])
posIMGs += 1

if __name__ == '__main__':

test = googleImages()

test.getRandomImages()
test.downloadImages()

print 'Finito...'

source