This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
""" | |
iterate a bucket in s3 containing JSON log files | |
get each file, massage json a little and uploade to elasticsearc | |
""" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILENAME=records_111901_00000000.jsonl | |
split -a 5 -l 1 $FILENAME temp | |
n=1 | |
for f in temp* | |
do | |
cat $f >> Part${n}.json | |
rm $f | |
((n++)) | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILENAME=filename_here.csv | |
HDR=$(head -1 $FILENAME) | |
split -l 100 $FILENAME xyz | |
n=1 | |
for f in xyz* | |
do | |
if [ $n -gt 1 ]; then | |
echo $HDR > Part${n}.csv | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: https://github.com/springernature/scigraph/blob/master/2018Q3/context/scigraph.json | |
{ | |
"@context": { | |
"@vocab": "http://schema.org/", | |
"@base": null, | |
"sg": "http://scigraph.springernature.com/id/", | |
"sgo": "http://scigraph.springernature.com/ontologies/core/", | |
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", | |
"rdfs": "http://www.w3.org/2000/01/rdf-schema#", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"@context": { | |
"@vocab": "http://schema.org/", | |
"@base": null, | |
"sg.articles": "http://scigraph.springernature.com/things/articles/", | |
"sg.persons": "http://scigraph.springernature.com/things/persons/", | |
"sg.grants": "http://scigraph.springernature.com/things/grants/", | |
"sg": "http://scigraph.springernature.com/ontologies/core/" | |
}, | |
"@id": "sg.grants:grant.2691278", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Obtain the label of a given class (:class1). | |
SELECT DISTINCT ?c (STR(?l) AS ?lb) | |
WHERE { | |
?c a :class1 ; | |
<http://www.w3.org/2000/01/rdf-schema#label> ?l . | |
} | |
# Obtain a list of classes. | |
SELECT DISTINCT ?c | |
WHERE { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __getitem__(self, key): | |
""" | |
Basic slicing support up to 100 (QueryManager.BATCH_DEFAULT_SIZE) | |
https://docs.python.org/3/reference/datamodel.html#object.__getitem__ | |
This is just quick way to get samples items, as it works only for the initial batch of results. | |
Use the next() method to go through all the resultset. | |
""" | |
if isinstance( key, slice ) : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usual way | |
``` | |
<link href="{% static 'libs/bootswatch3.2/{{ THEME }}/bootstrap.min.css' %}" rel="stylesheet"> | |
``` | |
# more manual but works if you have variables in it | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: import ontospy | |
In [2]: o = ontospy.Ontospy("foaf.rdf") | |
In [4]: c = o.classes[0] | |
In [5]: c | |
Out[5]: <Class *http://www.w3.org/2000/10/swap/pim/contact#Person*> | |
In [6]: c.bestLabel() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;; On Beat ;;;;;;;;;;;;;;;;;;;;; | |
(define-macro (onbeat? b of t . f) | |
(if (null? f) | |
`(if (= (modulo beat ,of) (- ,b 1)) | |
,t) | |
`(if (= (modulo beat ,of) (- ,b 1)) |