Skip to content

Instantly share code, notes, and snippets.

View cmarat's full-sized avatar

Marat Charlaganov cmarat

View GitHub Profile
@cmarat
cmarat / cluster_state.status:red.json
Last active July 31, 2017 12:31
Query Elasticsearch .monitoring indices for periods of time when the cluster status was red
GET .monitoring-es*/cluster_state/_search
{
"size": 0,
"query": {
"bool": {
"filter": [
{
"term": {
"cluster_state.status": "red"
}
create procedure
cbw.DBA.csvExport( IN in_query VARCHAR, IN filename VARCHAR )
{
declare query varchar;
query := split_and_decode(in_query,0,'%');
file_delete(filename,1);
declare meta, _dt any;
; virtuoso.ini
;
; Configuration file for the OpenLink Virtuoso VDBMS Server
;
;
; Database setup
;
[Database]
DatabaseFile = virtuoso.db
TransactionFile = virtuoso.trx
@prefix api: <http://purl.org/linked-data/api/vocab#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dbo: <http://dbpedia.org/ontology/> .
@prefix dbpedia: <http://dbpedia.org/resource/> .
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cmarat
cmarat / corpus.py
Last active August 29, 2015 14:16
import nltk
cond = lambda s: any((pos == 'JJ' and len(word) > 4 and word[-3:] == 'ate' for word, pos in s))
sents = (s for s in nltk.corpus.brown.tagged_sents() if len(s) > 4 and len(s) < 16 and cond(s))
for sent in sents:
print(" ".join(zip(*sent)[0]))
@cmarat
cmarat / geonames.py
Last active January 11, 2018 19:20
Convert Geonames RDF dump to n-triples.
'''
Created on 13 Nov 2014
@author: <https://github.com/cmarat>
Convert Geonames RDF dump [1] to n-triples.
Uncompress the dump and pass the file name as a command
line parameter, or pipe it into stdin.
@cmarat
cmarat / country_names
Last active August 29, 2015 14:08
SPARQL Query Alternative Country Names
# Get alternative names of all countries from geonames. The query should have been
# much simpler, but
#
# 1) It's hard (or impossible) to tell cities from countries in the geonames data
# 2) In dbpedia too many things are dbo:Country whereas they are not.
#
# This was minimally tested using <http://lod.openlinksw.com/sparql>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
curl http://commondatastorage.googleapis.com/freebase-public/rdf/freebase-rdf-2014-06-23-18-07.gz | zgrep "<http://www.w3.org/2000/01/rdf-schema#label>"
@cmarat
cmarat / dbpedia_outbound.sh
Last active August 29, 2015 14:03
Clean and sort sameAs links from dbpedia to external resources
bzcat downloads.dbpedia.org/3.9/links/*nt.bz2 | grep '<http://www.w3.org/2002/07/owl#sameAs>' | awk '{if ( match($1, "<http://dbpedia.org/")==1) {print $1 " " $2 " " $3 " ."} else {print $3 " " $2 " " $1 " ."} }' | sort | bzip2 > sorted_outbound_sameas.nt.bz2 &