Skip to content

Instantly share code, notes, and snippets.

View caugner's full-sized avatar

Claas Augner caugner

View GitHub Profile
@caugner
caugner / date_difference.js
Created October 31, 2014 14:26
Determine intuitive difference between two dates
function date_difference(from_date, to_date) {
if (to_date < from_date) {
return date_difference(to_date, from_date);
}
var DAY_IN_MS = 1000 * 60 * 60 * 24;
// count first day
from_date = new Date(from_date.getTime() - DAY_IN_MS);
@caugner
caugner / libreoffice41-install.sh
Last active August 29, 2015 14:08
Install LibreOffice 4.1 under Ubuntu 14.04
sudo add-apt-repository -y ppa:libreoffice/libreoffice-4-1
sudo apt-get install \
libreoffice=1:4.1.6-0ubuntu1~trusty1~ppa1 \
libreoffice-base=1:4.1.6-0ubuntu1~trusty1~ppa1 \
libreoffice-base-core=1:4.1.6-0ubuntu1~trusty1~ppa1 \
libreoffice-core=1:4.1.6-0ubuntu1~trusty1~ppa1 \
libreoffice-calc=1:4.1.6-0ubuntu1~trusty1~ppa1 \
libreoffice-draw=1:4.1.6-0ubuntu1~trusty1~ppa1 \
libreoffice-impress=1:4.1.6-0ubuntu1~trusty1~ppa1 \
@caugner
caugner / ruby-re-german.rb
Created July 22, 2013 14:37
Ruby regular expression for German texts
#!/bin/ruby
# uppercase characters
uchar = 'A-ZÄÖÜÁÀÉÈ'
# lowercase characters
lchar = 'a-zäöüßáàéè'
# all characters
char = uchar + lchar
# whitespace characters
@caugner
caugner / getmx.sh
Created February 19, 2013 22:41
Get mail domain of a given domain
#!/bin/bash
if [ -n "$1" ]
then
host -t mx $1 | awk '{print $7}' | sed 's/.$//'
fi