Skip to content

Instantly share code, notes, and snippets.

View egonw's full-sized avatar
💭
I don't want a status.

Egon Willighagen egonw

💭
I don't want a status.
View GitHub Profile
@JervenBolleman
JervenBolleman / gist:60cc9dd13614c05fe9743519cd6ef5aa
Created December 4, 2018 11:13
Let virtuoso discover all sparql endpoints in wikidata and use it to improve federations capabilities
for iri in $(wget -q --header "accept:text/csv" "https://query.wikidata.org/sparql?query=SELECT DISTINCT ?iri WHERE { [] wdt:P5305 ?iri }" -O -|grep -oP '^http[\S]+')
do
echo "isql $port $user $password exec='LOAD SERVICE <$iri> DATA;'";
done
@ErikAugust
ErikAugust / spectre.c
Last active April 15, 2024 13:55
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
#!/usr/bin/env python
from sys import stdin, stdout
import csv
rdr = csv.reader(stdin, delimiter='\t')
wrt = csv.writer(stdout, delimiter='\t')
vals = []
rows = []
for row in rdr:
SELECT ?entity ?desc ?author ?wd_author WHERE {
?entity wdt:P31 wd:Q13442814. #filter by scientific articles
?entity wdt:P2093 ?wd_author.
FILTER(regex(?wd_author, "B.*Feringa"))
?entity rdfs:label ?desc.
FILTER((LANG(?desc)) = "en").
}
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 5 columns, instead of 4. in line 8.
MetaboLightsID ChEBIID CompoundName KEGGPathwaysMappings MTBLSMapping
MTBLC100 CHEBI:100 (-)-medicarpin Isoflavonoid biosynthesis; Biosynthesis of phenylpropanoids; Biosynthesis of secondary metabolites -
MTBLC100241 CHEBI:100241 ciprofloxacin ABC transporters -
MTBLC10072 CHEBI:10072 xanthurenic acid Tryptophan metabolism MTBLS20 (Homo sapiens (Human)); MTBLS71 (Homo sapiens);
MTBLC10136 CHEBI:10136 gingerol Stilbenoid, diarylheptanoid and gingerol biosynthesis; Biosynthesis of secondary metabolites MTBLS49 (Trypanosoma brucei brucei);
MTBLC10280 CHEBI:10280 (E,E)-alpha-farnesene Sesquiterpenoid and triterpenoid biosynthesis; Biosynthesis of secondary metabolites -
MTBLC10319 CHEBI:10319 1-naphthol Metabolism of xenobiotics by cytochrome P450; Naphthalene family -
MTBLC10352 CHEBI:10352 beta-amyrin Sesquiterpenoid and triterpenoid biosynthesis; Biosynthesis of terpenoids and steroids; Biosynthesis of secondary metabolites MTBLS215 (reference compound);
MTBLC10360 CHEBI:10360 (R)-(+)-citronellol Geraniol d
select distinct ?Concept1 ?p ?Concept2 where {
?res1 a ?Concept1 .
?res2 a ?Concept2 .
?res1 ?p ?res2 .
FILTER(?Concept1 != ?Concept2)
}
all: sql2rdf.jar
curl -s "http://ebi.edu.au/ftp/databases/chembl/ChEMBLdb/releases/chembl_20/chembl_20_mysql.tar.gz" |\
tar xOvzf - chembl_20_mysql/chembl_20.mysqldump.sql |\
java -cp sql2rdf.jar SQLToRDF
sql2rdf.jar : SQL2RDF.jj
javacc SQL2RDF.jj ## tested with javacc 5.0
javac SQLToRDF.java
jar cvf $@ *.class
@andrawaag
andrawaag / gpml
Created September 26, 2013 12:24
gpml language definition LaTeX listings package
% Language Definition for GPML
\usepackage{color}
\definecolor{gray}{rgb}{0.4,0.4,0.4}
\definecolor{darkblue}{rgb}{0.0,0.0,0.6}
\definecolor{cyan}{rgb}{0.0,0.6,0.6}
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
showstringspaces=false,
@egonw
egonw / 2009
Last active February 13, 2017 11:01
JChemInf DOIs
10.1186/1758-2946-1-1
10.1186/1758-2946-1-2
10.1186/1758-2946-1-3
10.1186/1758-2946-1-4
10.1186/1758-2946-1-5
10.1186/1758-2946-1-6
10.1186/1758-2946-1-7
10.1186/1758-2946-1-8
10.1186/1758-2946-1-9
10.1186/1758-2946-1-10
@jebyrnes
jebyrnes / ma_senate_2012.R
Created November 6, 2012 20:41
MA Senate Projection
#load the excellent methods to query polls
#linked to at http://alandgraf.blogspot.com/2012/11/quick-post-about-getting-and-plotting.html
source("https://raw.github.com/dlinzer/pollstR/master/pollsterAPI.R")
#get the MA Senate Race
datMass <- pollstR(chart="2012-massachusetts-senate-brown-vs-warren",pages="all")
#reshape the data for plotting
library(reshape2)
dm <- melt.data.frame(datMass, id.vars=c("start.date", "N"), measure.vars=c("Warren", "Brown"))