Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dettmering's full-sized avatar

Till Dettmering dettmering

View GitHub Profile
@dettmering
dettmering / Dockerfile
Created December 11, 2016 11:14
GSI GD Dockerfile
FROM ubuntu:16.04
MAINTAINER tilldettmering@gmail.com
RUN apt-get update &&\
apt-get install --no-install-recommends -y \
ksh \
xvfb \
wget &&\
apt-get clean -y && rm -rf /var/lib/apt/lists/*
@dettmering
dettmering / install-r.sh
Last active August 31, 2015 17:40
Compile R on Raspberry Pi
#!/bin/bash
# This can take a while. Run in a screen environment.
# Modify for the version you want to install.
RVERSION=3.2.2
sudo apt-get install screen gfortran libreadline6-dev libx11-dev libxt-dev
cd ~
@dettmering
dettmering / ml.R
Last active August 29, 2015 14:20
Machine learning template for R
library(caret)
library(doMC)
registerDoMC(cores = 4) # use multiple cores
set.seed(1234)
col.of.interest <- c(
'response', 'A', 'B', 'C'
)
@dettmering
dettmering / bahncard-vs-auto.Rmd
Last active September 20, 2015 17:20
Wochenendpendeln mit Bahn + BahnCard 50 oder Auto—was ist billiger?
```{r echo = FALSE, results = 'show'}
library(knitr)
```
# Vergleich Pendeln mit Auto vs. Bahn mit BahnCard 50
```{r}
# Fahrten pro Jahr (Wochenenden pro Jahr abzgl. Urlaub/Feiertage)
n.fahrten <- (52 - 7) * 2 # Fahrten in eine Richtung
@dettmering
dettmering / imgrename.sh
Created February 14, 2014 13:49
Bash: Renames groups of images (329L_**_000x.tif) with a combined md5 hash of the group (329L_**-bac8dacd79_000x.tif)
#!/bin/bash
# Rename image files with md5 hash
mkdir out
for f in *.tif
do
splt=(${f//_/ })
c=$(cat ${splt[0]}\_${splt[1]}\_* | md5) # 329L_23_*
o=${splt[0]}\_${splt[1]}\-${c:0:10}\_${splt[2]}
@dettmering
dettmering / colorpalette.R
Created October 1, 2013 13:55
R: Cool heatmap color palette
library(RColorBrewer)
brewer.pal(30, "RdYlBu")
@dettmering
dettmering / gist:5075213
Last active December 14, 2015 10:49
Bash: Parse all GD files in folder
#!/bin/bash
# This script creates eps files from all .gd or .exec files in a directory.
if [ ! -d "img/" ];
then
mkdir img
fi
rm img/*-gd.eps
touch execfile # Create execfile
@dettmering
dettmering / gist:5070274
Last active December 14, 2015 10:10
Python: Generate heat map
def rgb(r,g,b): # Just returns r, g, b in this case. Can be used to reformat RGB values if necessary.
return r,g,b
def heat(min, max, val, type): # Takes min and max values and the value to be heatmapped. Type is the look up table, see below.
min = float(min)
max = float(max)
val = float(val)
val = (val - min) / (max - min) # normalize val to min and max
@dettmering
dettmering / gist:4943573
Last active December 13, 2015 16:49
LaTeX: Template for generating PDF with figures for paper submission
\documentclass{article}
\usepackage[scaled]{helvet}
\usepackage[T1]{fontenc}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[nomarkers,nofiglist,figuresonly]{endfloat}
\pagenumbering{gobble} % removes page numbering
@dettmering
dettmering / gist:4587442
Last active December 11, 2015 10:29
LaTeX: TikZ playground.
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage[scaled]{helvet}
\usepackage[T1]{fontenc}
\usepackage{verbatim}
\renewcommand*\familydefault{\sfdefault} %% Only if the base font of the document is to be sans serif