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 / example.py
Last active October 7, 2020 21:44
CartPole-v0 with SARSA
import gym
import gym.spaces
gym.logger.set_level(40)
gym.__version__
dapprox = grad(approx)
discount = 1.0 # Discount rate
epsilon = 0.2 # Exploration rate
alpha = 0.1 # Step size for gradient descent
w = np.zeros((4,2)) # Initalize weigths
@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 / bioinformatics.md
Last active October 11, 2018 15:55
Bioinformaticians Toolbox

Bioinformatician's Toolbox

This document aggregates snippets that I found useful when working in bioinfromatics. It is work in progress and I will extend it as needed. It is mainly in form of toy examples or pseudcode. Please adjust it accodring to your needs.

MariaDB

mysql --user=root -p
/*get preview */
show databases;
USE <some_database>;
show tables;
@martinholub
martinholub / _gunzip.sh
Last active February 3, 2020 11:27
Downloading and validating files from ftp/http locations. Tested mainly with Ensembl.
for f in {input}
do
# mkdir --parents $f
[[ $f == *.gz ]] && gunzip --keep $f
done