Skip to content

Instantly share code, notes, and snippets.

View Daniel-Mietchen's full-sized avatar
🐢
The climate crisis requires swift and sustained ACTION.

Daniel Mietchen Daniel-Mietchen

🐢
The climate crisis requires swift and sustained ACTION.
View GitHub Profile
# place this file in folder with pngs or jpgs
# run with python warmingstripes.py
# will work with non warming stripes images
# but will be an image with columns of the top row of pixels stretched down
from PIL import Image
import drawSvg as draw
import os
files = [i for i in os.listdir() if i.endswith("png") or i.endswith("jpg")]

How to use Gephi to visualize from Wikidata

I'm a long-time fan of the graph visualization tool Gephi and since Wikimania 2019 I got involved with Wikidata. I was aware of the Gephi plugin "Semantic Web Importer", but when I check it out, I only find old tutorials connecting to DBpedia, not Wikidata:

@hubgit
hubgit / cited-by.md
Created May 27, 2016 14:58
Cited-By APIs
@harej
harej / sourcemetadata_scraper.py
Created May 26, 2016 09:30
A script that scrapes tools.wmflabs.org/sourcemd
import requests
import time
import csv
from bs4 import BeautifulSoup
def main(sourcefile):
url_template = "https://tools.wmflabs.org/sourcemd/?id={0}&doit=Check+source"
with open(sourcefile) as f:
csvdump = csv.reader(f)
@mcfrank
mcfrank / pubmed.py
Created October 7, 2015 22:08
Example of using the Entrez API to get pubmed citations
## this little script shows off the use of the pubmed API through bioconductor
## requires installing Biopython (using pip)
## also requires installing the DTD files for each of the Entrez API calls,
## but the instructions for this are given when you run the script
## useful list of Entrez databases that can be queried through API
# pmc_pubmed PubMed citations for these articles
# pmc_refs_pubmed PubMed article citing PMC article
# pmc_pmc_cites PMC articles that given PMC article cites
# pmc_pmc_citedby PMC article citing given PMC article
library(SPARQL)
library(ggplot2)
library(rworldmap)
wdqs <- "https://query.wikidata.org/bigdata/namespace/wdq/sparql"
query = "PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
@giacecco
giacecco / Zoosystematics and Evolution
Created July 18, 2014 14:41
The URLs to all articles to date published on Wiley's "Zoosystematics and Evolution"
http://onlinelibrary.wiley.com/doi/10.1002/zoos.201300006/abstract
http://onlinelibrary.wiley.com/doi/10.1002/zoos.201300007/abstract
http://onlinelibrary.wiley.com/doi/10.1002/zoos.201300008/abstract
http://onlinelibrary.wiley.com/doi/10.1002/zoos.201300009/abstract
http://onlinelibrary.wiley.com/doi/10.1002/zoos.201300010/abstract
http://onlinelibrary.wiley.com/doi/10.1002/zoos.201300011/abstract
http://onlinelibrary.wiley.com/doi/10.1002/zoos.201300012/abstract
http://onlinelibrary.wiley.com/doi/10.1002/zoos.201300013/abstract
http://onlinelibrary.wiley.com/doi/10.1002/zoos.201300014/abstract
http://onlinelibrary.wiley.com/doi/10.1002/zoos.201300015/abstract
@giacecco
giacecco / main.js
Created July 18, 2014 14:40
Prints lists of articles from Wiley journals
var JOURNALS = {
D: 'journal/10.1002/(ISSN)1860-1324', // Deutsche Entomologische Zeitschrift
F: 'journal/10.1002/(ISSN)1860-1014', // Fossil Record
Z: 'journal/10.1002/(ISSN)1860-0743a', // Zoosystematics and Evolution
};
var argv = require('yargs')
.usage('Usage: $0 --journal D|F|Z --year <year>|all [--throttle <max_requests_per_minute>]')
.example('$0 --journal Z --year 2011', 'prints the urls for all Zoosystematics and Evolution articles in 2011')
.demand([ 'journal', 'year' ])
@stilkov
stilkov / Piraten2013.md
Last active December 23, 2015 14:49
Fünf Gründe, aus denen ich morgen Piraten wähle

Aus Gründen, über die ich mir selbst nicht ganz klar bin, verspüre ich einen starken Drang, meine politische Meinung zu teilen. Deshalb hier ganz kurz:

Fünf Gründe, aus denen ich morgen Piraten wähle

Netzkompetenz: Ich habe die Nase absolut voll davon, dass Leute ohne jede Kenntnis von der Sache Gesetze zur digitalen Gesellschaft erfinden. Dass die Piraten in technischer, aber auch juristischer Kompetenz hier ganz weit vorne liegen, bestreitet wahrscheinlich niemand.

Bürgerrechte: Das scheint ein Thema zu sein, das den meisten Bürgern – und in der Folge insbesondere den sogenannten „Volksparteien” – vollkommen egal oder sogar ein Dorn im Auge ist. Bei den Piraten sehe ich hier das mit Abstand klarste Bekenntnis.

Transparenz: Während die Piraten Privatsphäre für Bürger und völlige Transparenz für den Staat und seine Organe fordern, scheint es insbesondere unserer Regierung genau andersherum lieber zu sein.

@markmacgillivray
markmacgillivray / additional
Created May 10, 2012 10:46
Convert records from Medline, MalariaWorld, and Wikipedia Open Access Media Importer from their native formats into BibJSON
# query to retrieve articles relevant to malaria from indices
# and write the result object to search.json
# (change ES URL target and size param for different datasets)
# size can be discovered by looking at the value in data['hits']['total']
# 10 are returned at a time by default, so just increase to a number larger than total
curl -X GET 'http://localhost:9200/medline2012/record/_search?size=10000&q=gametocyte%20OR%20merozoite%20OR%20sporozoite%20OR%20trophozoite%20OR%20schizont%20OR%20artemisia%20OR%20ITN%20OR%20LLIN%20OR%20malaria%20OR%20mosquito%20OR%20anopheles%20OR%20plasmodium%20OR%20falciparum%20OR%20vivax%20OR%20ovale%20OR%20malariae%20OR%20knowlesi%20OR%20DDT%20OR%20pyrethroid%20OR%20carbamate%20OR%20organophosphate%20OR%20ogranochlorine%20OR%20bednet%20OR%20repellent%20OR%20artemisinin%20OR%20chloroquine%20OR%20quinine%20OR%20artesunate%20OR%20lumefantrin%20OR%20mefloquine%20OR%20atovaquone%20OR%20paludrine%20OR%20"insecticide%20treated%20bednet"%20OR%20"indoor%20residual%20spraying"' -o search