Skip to content

Instantly share code, notes, and snippets.

View gaurav's full-sized avatar

Gaurav Vaidya gaurav

View GitHub Profile
@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 / 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 / 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 / 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;})()
{
"result": [
{
"summary": {
"clazz": {
"Polypodiopsida": 1,
"Filicopsida": 1
},
"taxonomicStatus": "ACCEPTED",
"key": {
#!/usr/bin/perl
# This is the program I wrote to crack this fun little cipher: http://keiththomsonbooks.com/cipher-02022012.html
# The clue clearly indicates that this is just a simple substitution cipher [1]; even better, it looks like ROT13 [2],
# except that you clearly don't move every letter along by exactly 13 places. So how many letters do you need to move
# it along by? There's only 26 letters in the English alphabet: let's try every possible value!
#
# [1] http://en.wikipedia.org/wiki/Substitution_cipher
# [2] http://en.wikipedia.org/wiki/ROT13
@gaurav
gaurav / .vimrc
Last active April 29, 2017 04:09
My .vimrc file
" Activate pathogen.
call pathogen#infect()
call pathogen#helptags()
" These are a few of my favourite settings.
syntax on
set background=dark
set hlsearch
set incsearch
set smartindent
@gaurav
gaurav / test.json
Last active December 13, 2017 15:30
Converting a blank node from JSON-LD (test.json) -> XML/RDF (test.xml) -> JSON-LD (test_back.json) and Turtle (test_back.ttl)
{
"@context": {
"obo": "http://purl.obolibrary.org/obo/",
"denotes": {
"@id": "obo:IAO_0000219",
"@type": "@id"
}
},
[{
"@context": "https://www.phyloref.org/curation-tool/json/phyx.json",
"@type": "owl:Ontology",
"citation": "Example"
}]
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:ns1="http://www.w3.org/2002/07/owl#"
xmlns:ns2="http://www.essepuntato.it/2012/04/tvc/"
xmlns:ns3="http://rs.tdwg.org/dwc/terms/"
xmlns:ns4="http://vocab.phyloref.org/phyloref/testcase.owl#"
xmlns:ns5="http://purl.org/opentree/nexson#"
xmlns:ns6="http://purl.obolibrary.org/obo/"
xmlns:ns7="http://ontology.phyloref.org/phyloref.owl#"
xmlns:ns8="http://purl.org/spar/pso/"