Skip to content

Instantly share code, notes, and snippets.

View VladimirAlexiev's full-sized avatar

Vladimir Alexiev VladimirAlexiev

View GitHub Profile
# University of Washington, Programming Languages, Homework 7,
# hw7tests.rb
require 'simplecov'
SimpleCov.command_name "My Tests"
SimpleCov.start
require "./hw7testsprovided.rb"
class Object
@VladimirAlexiev
VladimirAlexiev / bibtex-autokey-use-crossref-instead-of-year.patch
Created January 9, 2014 14:00
Patch to bibtex-autokey that implements a key format commonly used on CEUR-WS (e.g. see http://ceur-ws.org/Vol-1032/CSP2013.bib). It uses crossref instead of year: eg Alexiev:TPDL2012 instead of Alexiev:2012
--- bibtex-orig.el 2014-01-08 17:19:01.808353200 +0200
+++ bibtex.el 2014-01-08 17:45:06.771864000 +0200
@@ -1066,4 +1066,13 @@
:type 'boolean)
+(defcustom bibtex-autokey-use-crossref-instead-of-year nil
+ "If non-nil then use the crossref field instead of the year.
+Eg if crossref={TPDL2012} then the autokey could become Alexiev:TPDL2012 instead of Alexiev:2012. Nice!
+In this case bibtex-autokey-year-length is ignored,
+and you better set bibtex-autokey-name-separator to \":\" and may want to set bibtex-autokey-titlewords to 0.
@VladimirAlexiev
VladimirAlexiev / iana-lang-tags.pl
Created January 31, 2014 14:49
Get the IANA Language Tag registry, parse it, and write it to a tab-delimited file
#!perl -w
# Parse out "http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
# And write it to a tab-delimited file.
# Format described at http://tools.ietf.org/html/bcp47#section-3.1.2
# TODO: use some Excel writer to split into sheets by Type
use LWP::Simple;
$_ = get("http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry") or die;
@VladimirAlexiev
VladimirAlexiev / prefixes.ttl
Last active August 29, 2015 14:08
Convert a NTriples file (which is impossible to read) by adding prefixes. The result is line-oriented Turtle, which can be diffed easily. This way you can compare two representations of the same resource (see shell example below)
wget http://rdaregistry.info/Elements/a.jsonld
wget http://rdaregistry.info/Elements/a.ttl
riot a.jsonld | perl prefixize.pl | sort > ajson.nt
riot a.ttl | perl prefixize.pl | sort > attl.nt
diff -u0 ajson.nt attl.nt > a.diff
@VladimirAlexiev
VladimirAlexiev / a.diff
Created November 6, 2014 08:20
Results of compring RDA jsonld vs turtle representation: https://github.com/RDARegistry/RDA-Vocabularies/issues/43
--- ajson.nt 2014-11-06 09:47:41.343460100 +0200
+++ attl.nt 2014-11-06 09:47:45.678476000 +0200
@@ -1,2 +1,2 @@
-rdaa: rdfs:label "RDA Agent properties"@en .
-rdaa: reg:url <http://metadataregistry.org/schema/show/id/81.html> .
+rdaa: dc:title "RDA Agent properties"@en .
+rdaa: skos:note "Properties derived from RDA elements and relationship designators with the domain of RDA Agent."@en .
@@ -10,2 +10,2 @@
-rdaa:P50001 reg:hasUnconstrained rdau:P60001 .
-rdaa:P50001 reg:lexicalAlias rdaa:respondentOf.en .
1234 rc:Action
11621 rc:Actor
452 rc:Actor_Voice
4647 rc:AilmentCondition
2457 rc:AirlineCompany
9520 rc:Airport_Physical
10000 rc:Album_IBO
341 rc:Algae
254 rc:Ambassador
6841 rc:Amphibian
@VladimirAlexiev
VladimirAlexiev / wikidata-instClass-anonymous.txt
Created January 25, 2015 08:08
Wikidata instance counts as of Jan 2015
218|Q12600360|
194|Q18116579|
167|Q366301|
156|Q14858002|
144|Q18511695|
114|Q17503488|
86|Q11910247|
86|Q18218242|
78|Q15206070|
78|Q14694851|
@VladimirAlexiev
VladimirAlexiev / FD-grandchildren.json
Last active August 29, 2015 14:14
DBpedia Food and Drink Categories
{"name":"Food_and_drink",
"children":[{"name":"Agriculture",
"children":[{"name":"Agrarianism"},
{"name":"Agricultural_buildings"},
{"name":"Agricultural_chemicals"},
{"name":"Agricultural_education"},
{"name":"Agricultural_establishments"},
{"name":"Agricultural_health_and_safety"},
{"name":"Agricultural_insects"},
{"name":"Agricultural_labor"},
@VladimirAlexiev
VladimirAlexiev / README.md
Last active August 29, 2015 14:14
DBpedia Categories as Cluster Dendrogram
# Endpoint http://vocab.getty.edu/sparql
select ?t ?name (count(*) as ?c) {
?x gvp:placeType ?t. ?t gvp:prefLabelGVP/xl:literalForm ?name
} group by ?t ?name
# 0. Inspired by https://twitter.com/paregorios/status/568513448130187264
# 1. This includes place types AND cultures/styles (eg "religious center" and "Maya")
# 2. Exploring the AAT hierarchy above these types could also be interesting
# 3. We also provide TGN counts as per Mar 2015
# 4. The query is a bit expensive (1.2M places, 2.7M type instances), so be nice and use the attached TSV