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
import pytest | |
from typing import List | |
def method_under_test(values: List[int]) -> int: | |
"""dummy method""" | |
if 0 in values: | |
raise(ValueError("Zeros are not supported")) | |
return sum(values) | |
@pytest.mark.parametrize( |
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
"""How to create a sparse vector for dlib from a numpy array. | |
dlib: http://dlib.net/ | |
""" | |
import dlib | |
import numpy | |
vector = [0,2,0] | |
sv = dlib.sparse_vector() | |
for i in numpy.nonzero(vector)[0]: |
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
GET _analyze | |
{ | |
"text": "Quick fox", | |
"tokenizer": { | |
"type": "ngram", | |
"min_gram": 3, | |
"max_gram": 4, | |
"token_chars": [ | |
"letter", | |
"digit" |
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
tui,label | |
T001,Organism | |
T002,Plant | |
T004,Fungus | |
T005,Virus | |
T007,Bacterium | |
T008,Animal | |
T010,Vertebrate | |
T011,Amphibian | |
T012,Bird |
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
# coding:utf-8 | |
from elasticsearch import Elasticsearch | |
import json | |
# Define config | |
host = "127.0.0.1" | |
port = 9200 | |
timeout = 1000 | |
index = "index" |
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
place the line below above the offensive code part | |
# noinspection SpellCheckingInspection | |
for IDEA, the analogon is | |
@SuppressWarnings("SpellCheckingInspection") |
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
es = Elasticsearch() | |
tokens = es.indices.analyze( | |
body={"analyzer": "german", | |
"text": "Die junge Informatikerin Katie Bouman machte die " | |
"historische Aufnahme eines schwarzen Lochs " | |
"möglich."})['tokens'] | |
for token in tokens: | |
print(token) | |
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
for doc in collection: | |
yield { | |
'_id': id, '_type': TYPE, | |
'_index': index, | |
# with "doc_as_upsert": True, the document is either updated | |
# or created if it does not already exist. | |
'_op_type': 'update', 'doc': doc, "doc_as_upsert": True | |
} |
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
find . -type f -newermt '2018/10/14' -not -newermt '2018/10/21'| cpio -pvdmB <your-directory> |
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
for i in `find . -type f -newermt '2018/10/14' -not -newermt '2018/10/21'`; do cp -p $i <your_folder>/; done |
NewerOlder