Skip to content

Instantly share code, notes, and snippets.

View samuelstein's full-sized avatar
👨‍💻

Samuel samuelstein

👨‍💻
View GitHub Profile
@samuelstein
samuelstein / jenkins-seed.groovy
Created February 7, 2018 10:32
Jenkins Seed job for Gitlab projects
// jenkins job dsl plugin is required!
// This job will be run through the gitlab projects (except user owned ones) and generate jenkins jobs with maven goal. if there should be no job generated, then the label 'nojob' must be set in repository config.
// reads projects from gitlab and creates jobs
def gitUrl = '$URL'
def privateToken = '$TOKEN'
def allowedNamespaces = ['product', 'innovation']
def reposToIgnoreTag = 'nojob'
def jobNames = []
@samuelstein
samuelstein / HTTPSRedirectFilter.java
Created November 14, 2017 10:07
HTTPS Redirect filter for play framework (>=2.5)
package utils.filters;
import akka.stream.Materializer;
import play.Configuration;
import play.mvc.Filter;
import play.mvc.Http;
import play.mvc.Result;
import javax.inject.Inject;
import java.util.concurrent.CompletionStage;
@samuelstein
samuelstein / MailHelper.java
Created March 23, 2017 10:10
Generates mail like: name.surname@example.com
public static String generateMail(String name, String surname) {
String[] searchList = {"ä", "ö", "ü", "ß"};
String[] replaceList = {"ae", "oe", "ue", "ss"};
String mailAddress = StringUtils.defaultIfBlank(StringUtils.lowerCase(name, Locale.GERMAN), "vorname") + "." + StringUtils.defaultIfBlank(StringUtils.lowerCase(surname, Locale.GERMAN), "nachname");
mailAddress = mailAddress.replace(" ", "-");
mailAddress = StringUtils.replaceEachRepeatedly(mailAddress, searchList, replaceList);
return StringUtils.stripAccents(mailAddress) + Constants.DEFAULT_MAIL_DOMAIN;
}
@samuelstein
samuelstein / ColorHelper.java
Last active March 23, 2017 10:09
Convert RGB triplet to HEX
public static String toHexString(short[] triplet) {
return "#" + Integer.toHexString(new java.awt.Color(triplet[0], triplet[1], triplet[2]).getRGB()).substring(2);
}
@samuelstein
samuelstein / Ubuntu_Aerial.md
Last active November 27, 2016 18:36 — forked from Dhertz/Ubuntu_Aerial.md
Quick overview of how to get Apple's new TV screensavers working on most linux systems.

Using Apple’s Aerial Screensavers on Ubuntu After coming across the [Aerial] (https://github.com/JohnCoates/Aerial) screensavers for Mac, and installing them, I decided that I had had enough of the graphics-demos of my Ubuntu Precise system. I hope to provide a simple guide on how to add them to your setup as well.

First, you need to install xscreensaver (for example with aptitude, but your distro should have it):

sudo apt-get install xscreensaver