Skip to content

Instantly share code, notes, and snippets.

@migerh
migerh / day1.erl
Created August 15, 2015 15:58
erlang
-module(day1).
-export([count/1]).
-export([count10/0]).
-export([check/1]).
count([32| Rest]) -> count(Rest) + 1;
count([_| Rest]) -> count(Rest);
count([]) -> 1.
count10(10) -> 10;
@migerh
migerh / xrandr scale example
Created January 19, 2011 22:30
get a higher resolution on low res screens via xrandr with scaling and output the high res one on an external monitor
#!/bin/bash
# ~/Scripts/1024scale.sh
# change display settings to clone mode, 1024x768 pix for VGA (projector) and scales it to the resolution of 1024x600 of the internal display
xrandr --newmode "1024x768" 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync
xrandr --addmode VGA1 1024x768
xrandr --fb 1024x768
xrandr --fb 1024x768 --output LVDS1 --mode 1024x600 --scale 1x1.28 --panning 0x0
xrandr --output VGA1 --same-as LVDS1 --mode 1024x768
@migerh
migerh / vdimount.py
Created February 5, 2011 19:40
Mount a VirtualBox .vdi HDD Image File
#!/usr/bin/env python
import sys
import os
import subprocess
def usage():
print "Usage:\n\n " + sys.argv[0] + " <vdi-File> <mount point>"
if len(sys.argv) < 3:
@migerh
migerh / gist:1275805
Created October 10, 2011 17:08
cuda c example matrix addition with #blocks >= 1
// Kernel definition
__global__ void MatAdd(float A[N][N], float B[N][N], float C[N][N]) {
int i = blockIdx.x * blockDim.x + threadIdx.x;
int j = blockIdx.y * blockDim.y + threadIdx.y;
if (i < N && j < N)
C[i][j] = A[i][j] + B[i][j];
}
int main() {
// Kernel invocation
@migerh
migerh / 4min-admin-guide-test.md
Last active April 9, 2019 16:56
markdown test stuff
@migerh
migerh / Dockerfile
Created September 7, 2018 20:00
hello gitlab registry
FROM node:10
COPY hello.js /
CMD ["node", "/hello.js"]
@migerh
migerh / converge.js
Last active August 10, 2018 19:41
ramda.js forked processing
const person = {
first: "Nikola",
last: "Testa"
};
const getFirstName = prop('first');
const getLastName = prop('last');
const whitespace = () => ' ';
const concatenateMultipleStrings = unapply(reduce(concat, ''))
@migerh
migerh / gist:5029208
Created February 25, 2013 11:21
rfc 2822 email regex
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
@migerh
migerh / .babelrc
Created September 22, 2016 17:24
JSXGraph import example
{
"presets": [
"es2015",
"stage-3"
],
"plugins": [
"transform-runtime"
]
}
@migerh
migerh / Dockerfile
Last active May 20, 2016 04:21
pdftk docker container
FROM ubuntu:16.04
MAINTAINER Michael Gerhaeuser <michael.gerhaeuser@gmail.com>
RUN mkdir /work
WORKDIR /work
VOLUME ["/work"]
RUN apt-get update
RUN apt-get install -y --no-install-recommends pdftk sudo