Skip to content

Instantly share code, notes, and snippets.

@elgehelge
elgehelge / DTU globalproxy bookmark
Created April 24, 2015 15:22
Get access to all academic articles as a DTU student
// Step 1: Put this code in a bookmark.
// Step 2: Click the bookmark everytime you need access to an academic article.
// Step 3: Profit!?
javascript: var a=window.location+''; var x=a.indexOf('//'); var p; if(x == -1) { p = a.indexOf('/'); } else { p = a.indexOf('/',x+2); } window.location = a.substring(0,p)+".globalproxy.cvt.dk"+a.substring(p);
@elgehelge
elgehelge / wikipedia_api__query_all_from_category
Created February 10, 2015 16:42
Efficiently query all articles from a category on Wikipedia (using Python)
import requests
parameters = {'action': 'query',
'generator': 'categorymembers',
'gcmtitle': 'Category:Marvel_Comics_superheroes',
'prop': 'revisions',
'rvprop': 'content',
# The API starts returning dictionaries without the 'revisions' key when requesting more than 50.
# Not sure why, and can't find any documentation.
'gcmlimit': 50,