Skip to content

Instantly share code, notes, and snippets.

View rschumm's full-sized avatar

Rémy Schumm rschumm

  • zhaw InIT
  • Winterthur, Switzerland
  • 22:45 (UTC -12:00)
View GitHub Profile
@rschumm
rschumm / MacRecoveryHacks.md
Last active October 18, 2017 06:25
Mac Recovery Hacks

booten mit cmd-R

US-Tastatur:

 / | - 
 * | shift 8
 _ | shift ?
 - | ? 
@rschumm
rschumm / ZonedTimeZone.java
Created September 4, 2017 15:44
ZonedTimeZone
ZonedDateTime zonedDateTime = ZonedDateTime.now();
String token = zonedDateTime.format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
System.out.println(token);
ZonedDateTime zonedDateTime2 = ZonedDateTime.parse(token, DateTimeFormatter.ISO_ZONED_DATE_TIME);
String zeit = zonedDateTime2.format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
System.out.println(zeit);
@rschumm
rschumm / Regex.java
Created June 21, 2017 09:18
Java Regex 101
public static HypoInterestRohdaten parseLine(String line){
Matcher match = Pattern.compile("Lfz (\\d*).*@(\\d*.\\d*).*").matcher(line);
match.matches();
HypoInterestRohdaten rohdaten = new HypoInterestRohdaten();
rohdaten.setTerm(Integer.parseInt(match.group(1)));
rohdaten.setInterest(Double.parseDouble(match.group(2)));
return rohdaten;
}
//Tipp: https://regex101.com/
@rschumm
rschumm / Sort.java
Created December 2, 2016 14:21
Java 8 Stream sort
@Test
public void testSortAgentur() {
InputStream xml = this.getClass().getClassLoader().getResourceAsStream("devmodel/2/sfgsfgsfdg.XML");
AgenturenType agenturenType = JAXB.unmarshal(xml, AgenturenType.class);
List<AgencyType> agenturenListe = agenturenType.getAgency();
//Sortiert nach City, dann nach Typ umgekehrt
List<AgencyType> sortiert = agenturenListe.stream()
.sorted(Comparator.comparing(AgencyType::getAgencyType).reversed())
@rschumm
rschumm / FindFilesOptional.java
Last active November 30, 2016 14:24
Java 8 File- und Sortier-Zeugs
static Optional<Path> findXmlFile(File directory, String prefix) throws IOException {
if (!directory.exists()) {
return Optional.empty();
}
return Files
.find(directory.toPath(), 3,
(path, basicFileAttributes) -> path.toFile().getName().matches(prefix + ".*.XML"))
.sorted(Comparator.comparing(Path::getFileName).reversed()).findFirst();
@rschumm
rschumm / JPADirect.Java
Created July 13, 2016 12:16
JPA Standalone
package ch.schumm.orgdaten.tools;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.SQLException;
<profile>
<id>tutum</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>public-snapshots</id>
<url>http://nexus.asdf.svc.tutum.io:8081/content/groups/public/
</url>
@rschumm
rschumm / aREADME.md
Last active February 1, 2016 14:31
Display maven Version on Homepage
  • benutze das maven-Filterin
  • die Filter "filtern" die Files und ersetzen darin maven-Variablen
  • man kann die Properties in ein Properties-file reinfiltern, oder dann direkt in ein HTML.
@rschumm
rschumm / Client.java
Created July 9, 2015 12:37
RESTEasy Generic Type List Client etc.
List<Registration> registrationList = response.readEntity(new GenericType<List<Registration>>() {});
@rschumm
rschumm / Resource.java
Created June 10, 2015 08:15
Loading Resource in JBoss
URL url = MeineKlasse.class.getClassLoader().getResource(datei);
try {
return new BufferedReader(new InputStreamReader(url.openStream()));