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 cv2 # opencv | |
import numpy as np | |
font_scale = 1.5 | |
font = cv2.FONT_HERSHEY_PLAIN | |
# set the rectangle background to white | |
rectangle_bgr = (255, 255, 255) | |
# make a black image | |
img = np.zeros((500, 500)) |
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 argparse | |
import os | |
import fasttext | |
from sklearn.base import BaseEstimator | |
from sklearn.metrics import f1_score | |
from sklearn.model_selection import cross_val_score, StratifiedKFold | |
def read_data(data_dir): |
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
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
# 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
# copy your cron jobs | |
crontab -l > cron.txt | |
# copy the exported config to otherHost | |
scp cron.txt otherHost:/your_directory | |
# login to otherHost | |
ssh otherHost | |
# set the cronjobs to your old config | |
crontab cron.txt |
NewerOlder