Skip to content

Instantly share code, notes, and snippets.

View gaurav's full-sized avatar

Gaurav Vaidya gaurav

View GitHub Profile
@gaurav
gaurav / citeulike-by-selection
Created June 5, 2013 04:42
Bookmarklet to add selection (i.e. DOI or URL) to CiteULike
javascript:(function(){var t=window.getSelection?window.getSelection().toString():document.selection.createRange().text; window.location="http://www.citeulike.org/posturl?url="+t;})()
@gaurav
gaurav / sources.sparql
Created November 26, 2015 21:08
Searching for sources within a category on the DBpedia commons
SELECT DISTINCT ?page ?source WHERE {
?page <http://purl.org/dc/terms/subject> <http://commons.dbpedia.org/resource/Category:Media_from_Open_Beelden> .
?page dcterms:source ?source
}
@gaurav
gaurav / delimit2rdf.pl
Created October 2, 2012 08:03
A file to split a DwC-A file into triples
#!/usr/bin/perl -w
use strict;
use warnings;
use v5.10.0;
=head1 NAME
delimit2rdf.pl -- Delimited file to RDF
@gaurav
gaurav / flickr_species_badge.html
Created April 5, 2012 06:07
A species badge (for Panthera tigris) from Flickr
<script>
var species_name = "Panthera tigris"; // Tweak this
var number_of_images = 5; // Tweak this
</script>
<!-- Start of Flickr Badge -->
<style type="text/css">
#flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;}
#flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;}
#flickr_icon_td {padding:0 5px 0 0 !important;}
@gaurav
gaurav / iucn.json
Created November 22, 2011 03:38
A bigger GeoJSON file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Atom Zombie Smasher
Commander: Gaurav
Start date: November 19, 2011
Zeppelin: One Moon Zeppelin
Codename: OperationWakingHeron528
----------------------------------
JANUARY 1961: AURORA AUSTRALIS.
Shorter daytime.
@gaurav
gaurav / unicode.json
Created November 17, 2011 22:51
A GeoJSON file containing Unicode text.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gaurav
gaurav / gist:1215190
Created September 13, 2011 21:10
Spotlight not functional
Machine:
PowerPC G5 Mac OS X 10.5.8
Symptoms:
1. Spotlight completely non-functional.
2. Running `sudo mdutil -i on /` results in error code -1.
3. No 'mds' or 'mdworker' running in Activity Manager.
Solution:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
@gaurav
gaurav / bulkloader-log-20110829.143822
Created August 29, 2011 21:06
Error output while uploading LayerIndex
[INFO 2011-08-29 14:38:22,517 bulkloader.py] Logging to bulkloader-log-20110829.143822
[INFO 2011-08-29 14:38:22,518 bulkloader.py] Throttling transfers:
[INFO 2011-08-29 14:38:22,518 bulkloader.py] Bandwidth: 250000 bytes/second
[INFO 2011-08-29 14:38:22,518 bulkloader.py] HTTP connections: 8/second
[INFO 2011-08-29 14:38:22,518 bulkloader.py] Entities inserted/fetched/modified: 20/second
[INFO 2011-08-29 14:38:22,518 bulkloader.py] Batch Size: 10
[INFO 2011-08-29 14:38:23,649 bulkloader.py] Opening database: bulkloader-progress-20110829.143822.sql3
[DEBUG 2011-08-29 14:38:23,656 adaptive_thread_pool.py] [WorkerThread-0] WorkerThread: started
[DEBUG 2011-08-29 14:38:23,657 adaptive_thread_pool.py] [WorkerThread-1] WorkerThread: started
[DEBUG 2011-08-29 14:38:23,657 adaptive_thread_pool.py] [WorkerThread-2] WorkerThread: started
@gaurav
gaurav / get_fusion_table.py
Created August 24, 2011 06:19
Simple code to download a Fusion Table which is being shared publically
#!/usr/bin/python
import urllib
tableid = 1344517 # A dummy but public fusion table I created
sql = "SELECT * FROM %d" % tableid
file = urllib.urlopen("https://www.google.com/fusiontables/api/query?sql=" + urllib.quote_plus(sql))
print file.read()
# Expected output: