This file contains hidden or 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
| #https://www.postgresql.org/docs/current/dict-xsyn.html | |
| DROP TEXT SEARCH CONFIGURATION text_search_dict; | |
| DROP TEXT SEARCH DICTIONARY mysyn; | |
| CREATE TEXT SEARCH DICTIONARY mysyn (TEMPLATE = xsyn_template, RULES = mysyn); | |
| ALTER TEXT SEARCH DICTIONARY mysyn(RULES='mysyn', KEEPORIG=false); | |
| CREATE TEXT SEARCH CONFIGURATION text_search_dict (COPY = english); | |
| ALTER TEXT SEARCH CONFIGURATION text_search_dict ALTER MAPPING FOR word, asciiword WITH mysyn, english_stem; | |
| with food_with_synms as (SELECT food_id, sponsor_id, portion_id, preparations, brand_name, index_vector, index_string |
This file contains hidden or 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 | |
| cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1/lib .. |
This file contains hidden or 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
| apt install curl | |
| curl https://bazel.build/bazel-release.pub.gpg | apt-key add - | |
| echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list | |
| apt update | |
| apt install python3 python3-numpy git bazel-1.2.1 | |
| cd /opt && git clone https://github.com/tensorflow/tensorflow.git && cd tensorflow | |
| ./configure | |
| bazel build -c opt --config=monolithic //tensorflow:libtensorflow_cc.so | |
| https://medium.com/@tomdeore/standalone-c-build-tensorflow-opencv-6dc9d8a1412d |
This file contains hidden or 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 logging | |
| class GetLog: | |
| """ | |
| This is just a helper class that return logging.logger object with proper setup. | |
| Usage: | |
| info_log = GetLog.setup_logger("info", log_file=log_dir + "info.log", | |
| level=logging.INFO) | |
| error_log = GetLog.setup_logger("error", log_file=log_dir + "error.log", | |
| level=logging.ERROR) |
This file contains hidden or 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 check_connection(self): | |
| """ | |
| Routine that check connection with OpenStack and storing api_key to database. | |
| Get necessary value from xml. | |
| """ | |
| try: | |
| indata = sys.stdin.read() | |
| tree = XMLTree(indata) | |
| ip = tree.get_element(".//ip") | |
| password = tree.get_element(".//password") |
This file contains hidden or 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 create(self): | |
| id = Database.OpenstackUsers.replace( | |
| billing_user_id=self.billing_id, os_user_id=self.ostack_user_id, | |
| os_password_cr=Billing.crypt_password(self.password), proc_module_id=self.proc_module | |
| ).execute() | |
| self.save_token(id) | |
| return self | |
| def save_token(self, id): | |
| token_data = dict( |
This file contains hidden or 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 __item_works(self, Item, func_dict): | |
| class_name = Item.__class__.__name__.lower() | |
| if class_name not in func_dict: | |
| raise ValueError("{} is not implemented".format(class_name)) | |
| try: | |
| item = func_dict.get(class_name)('') | |
| return item | |
| except Exception as e: | |
| raise e |
This file contains hidden or 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 send_api_call(self, url, method="post", **kwargs): | |
| """ | |
| Helper that used for sending API-call | |
| :param method: Type of HTTP method | |
| :param url (string): Full url that represent a call | |
| :param json_object (json): JSON object that must be transferred in call | |
| :return: request.response object | |
| """ | |