Skip to content

Instantly share code, notes, and snippets.

@goraj
goraj / video_recorder_setup_videoio.cpp
Created February 24, 2018 13:44
video_recorder_setup_videoio.cpp
bool video_recorder::setup_videoio(cv::Mat & mat, double fps) {
std::string cmdline = ffmpeg_path_.string() +
" -framerate " + std::to_string(static_cast<int>(fps)) +
" -f image2pipe -vcodec png -i - -c:v libx264 -pix_fmt yuv444p" +
" -preset faster " +
//" -preset ultrafast " +
" -crf 14" +
//" -qp 0 " +
" -vf drawtext=\"fontcolor = white:fontfile = " +
def offset_version_detection(quality_string = ''):
"""Tries to detect phred score offset automatically.
Args:
quality_string used to estimate format version and offset
Returns:
Phred offset
Raises:
ValueError: Cannot evaluate empty quality string
ValueError: Cannot evaluate phred offset
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 21 08:36:44 2018
@author: user
"""
import cv2
import numpy as np
def ic50_in_nM_to_pic50(nM):
try:
return 9.0 - math.log10(float(nM))
except Exception as e:
return 0.0
def ic50_in_uM_to_pic50(uM):
nM = uM * 1000
return ic50_in_nM_to_pic50(nM)
@goraj
goraj / oob_patch.py
Created August 12, 2018 02:02
custom oob score function sklearn
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 10 21:41:24 2018
@author: goraj
"""
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from warnings import warn
@goraj
goraj / reproduce.py
Created December 3, 2018 20:35
reproduce.py
'''
>>> dask.__version__
'1.0.0'
>>> umap.__version__
'0.3.7'
'''
from dask.distributed import Client
def do_run(arg1, arg2):
@goraj
goraj / reproduce_segfault.log
Created December 5, 2018 22:11
reproduce_segfault.log
-bash-4.2$ ./Miniconda3-latest-Linux-x86_64.sh -b -p ~/m3_centos7
PREFIX=/home/username/m3_centos7
installing: python-3.7.0-hc3d631a_0 ...
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0]
installing: ca-certificates-2018.03.07-0 ...
installing: conda-env-2.6.0-1 ...
installing: libgcc-ng-8.2.0-hdf63c60_1 ...
@goraj
goraj / dask.py
Created February 4, 2019 18:58
dask.py
import time
import numpy as np
import pandas as pd
from dask.distributed import Client
from dask_jobqueue import SGECluster
from distributed.deploy.local import LocalCluster
from math import sqrt
from joblib import Parallel, delayed
N_CORES = 2
@goraj
goraj / UGE.md
Last active February 15, 2019 22:55
Add and retrieve additional attributes (-ac) for SGE/UGE cluster jobs

Add and retrieve additional attributes (-ac) for SGE/UGE cluster jobs

Add tags to running job

qalter -ac tag1=test 18458303

qalter -ac tag2=test 18458303

qalter -ac -ac tag1=test tag2=test 18458303

<?xml version="1.0" encoding="UTF-8"?><cml xmlns="http://www.chemaxon.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.chemaxon.com/marvin/help/formats/schema/mrvSchema_6_2_0.xsd" version="ChemAxon file format v6.2, generated by v6.3.0">
<MDocument><MChemicalStruct><reaction><arrow type="DEFAULT" x1="-7.259480881745031" y1="1.3737404197296181" x2="-1.0587105901089497" y2="1.3539927419708107"></arrow><propertyList><property dictRef="NAME" title="NAME"><scalar><![CDATA[Suzuki coupling]]></scalar></property><property dictRef="EXPLAIN_REACTIVITY" title="EXPLAIN_REACTIVITY"><scalar><![CDATA[First reactant is boronic acid, boronic ester, borane, trifluoroborate salt or boronic acid anhydride. Second reactant may be halogenide or organosulfonate or methyl sulfide as these compounds behave as pseudohalogen compounds.]]></scalar></property><property dictRef="EXPLAIN_EXCLUDE" title="EXPLAIN_EXCLUDE"><scalar><![CDATA[Second reactant may not contain such functional groups which co