Skip to content

Instantly share code, notes, and snippets.

View TVect's full-sized avatar
🏠
Working from home

TVect

🏠
Working from home
View GitHub Profile
@TVect
TVect / partial_conformation_search.cpp
Created July 3, 2023 03:32
使用 openbabel 做固定部分结构的分子构象搜索. 来源于 https://www.insilico.jp/blog/2021/11/14/partial_conformation_search/
#include <fstream>
#include <iostream>
#include <string>
#include <openbabel/mol.h>
#include <openbabel/obconversion.h>
#include <openbabel/forcefield.h>
#include <openbabel/parsmart.h>
#include <openbabel/generic.h>
@TVect
TVect / timer.py
Created July 27, 2022 00:57
Python Timer Functions: Three Ways to Monitor Your Code https://realpython.com/python-timer/
import time
from contextlib import ContextDecorator
from dataclasses import dataclass, field
from typing import Any, Callable, ClassVar, Dict, Optional
class TimerError(Exception):
"""A custom exception used to report errors in use of Timer class"""
@dataclass
class Timer(ContextDecorator):
@TVect
TVect / k8s_job_utils.py
Created June 13, 2022 02:17
k8s job + python api
import os
import logging
import yaml
from string import Template
from kubernetes import client, config, watch
import enum
logger = logging.getLogger(__name__)

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@TVect
TVect / logging.py
Created May 25, 2022 03:46 — forked from kingspp/logging.py
Python Comprehensive Logging using YAML Configuration
import os
import yaml
import logging.config
import logging
import coloredlogs
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'):
"""
| **@author:** Prathyush SP
| Logging Setup
@TVect
TVect / install_docker_ubuntu_16.04.sh
Created May 9, 2022 15:11 — forked from gauravkaila/install_docker_ubuntu_16.04.sh
Install Docker and nvidia-docker on Ubuntu-16.04
#!/bin/bash
# add the GPG key for the official Docker repository to the system
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# add the Docker repository to APT sources
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# update the package database with the Docker packages from the newly added repo
sudo apt-get update
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# /etc/screenrc
#
# This is the system wide screenrc.
#
# You can use this file to change the default behavior of screen system wide
# or copy it to ~/.screenrc and use it as a starting point for your own
# settings.
@TVect
TVect / keywords_ner.py
Created November 10, 2020 03:42
keywords ner
"""
Named Entity Recognition based on dictionaries
reference:
https://github.com/mpuig/spacy-lookup
https://spacy.io/usage/rule-based-matching
"""
import json
from flashtext import KeywordProcessor