Skip to content

Instantly share code, notes, and snippets.

View martinholub's full-sized avatar

Martin Holub martinholub

View GitHub Profile
body {
font-family: 'Open Sans', sans-serif;
font-weight: bold;
}
.nav {
background-color: white;
text-transform: uppercase;
font-weight: bold;
font-size: 15px;
position: fixed;
.header {
width: 100%;
height: 150px;
background-color: green;
}
#line {
background-color: black;
height: 40px;
}
#bio {
@martinholub
martinholub / logger_utils.py
Last active March 30, 2018 10:27
Utils script to construct file/stdout logger for calling module
import sys
from datetime import datetime
import logging
from inspect import getmodule
def _L(skip=0):
'''Shorthand to get logger from some parent frame
Parmeters:
-----------
@martinholub
martinholub / mathjax_local.js
Created April 15, 2018 11:42
Local MathJax Extension
MathJax.Hub.Config({
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [['$', '$']],
displayMath: [['$$', '$$'],['\\[','\\]']],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
},
messageStyle: "none",
"HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"] },
@martinholub
martinholub / setup.md
Last active July 14, 2018 08:02
Installing Jekyll on Linux

Setting up Jekyll on Linux

First, install Ruby and dependencies.
sudo apt-get install ruby ruby-dev build-essential

Create path for gems in your home.

echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME=$HOME/gems' >> ~/.bashrc
echo 'export PATH=$HOME/gems/bin:$PATH' >> ~/.bashrc
@martinholub
martinholub / callbacks_examples.py
Last active July 14, 2018 10:42
Double Dueling Deep Q-Learning Network
from keras.callbacks import Callback as KerasCallback, CallbackList as KerasCallbackList
from keras.callbacks import TensorBoard
from keras.optimizers import Adam, RMSprop
import keras.backend as K
class SubTensorBoard(TensorBoard):
"""Subclassing of tensorboard to log and visualize custom metrics and others
Note that for this to work, you will have to define a way how to handle `on_episode_end`
calls.
@martinholub
martinholub / add_buffer_gps.cpp
Last active July 15, 2018 07:58
Talking Bytes with The Things Network
void add_buffer_gps(double lat, double lon){
// offset by 90(180) to make positive and scale to 0..1
latB = ((lat + 90) / 180.0) * pow(256,3);
lonB = ((lon + 180) / 360.0) * pow(256,3);
// byte shifting
dataBuffer[0] = ( latB >> 16 ) & 0xFF;
dataBuffer[1] = ( latB >> 8 ) & 0xFF;
dataBuffer[2] = latB & 0xFF;
@martinholub
martinholub / rm_ext.py
Created October 10, 2018 09:00
Utilites for handling lists and filenames
def rm_ext(fname, ext = None):
"""Removes extension from filename"""
if not ext:
ext = re.match(".*\.(.*)$", fname).group(1)
else:
ext = ext.strip(".")
return re.sub("\." + ext + "$","", fname)
@martinholub
martinholub / transcript_snp.py
Last active October 10, 2018 11:18
Generating Transcriptomic SNV coordinates and annotation
class TranscriptomicSNP(object):
""" Generate a VCF file with transcriptomic coordinates
Gets transcriptomic snp loci in format <transc> <SNPpos> <additional_info...>.
# available:
# <chrom> <transc> <start> <end>
# <chrom> <SNVpos>
"""
@martinholub
martinholub / parse_args.sh
Created October 10, 2018 11:25
Parse arguments in bash
# Parse Arguments --------------------------------------------------------------
# reference: https://stackoverflow.com/a/14203146
POSITIONAL=()
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-v|--vcf)
vcf="$2"
shift # past argument