Skip to content

Instantly share code, notes, and snippets.

@manuelGitHub1
manuelGitHub1 / Localizer.java
Created November 9, 2022 09:23
Localize month name
public static String getGermanMonthName( final String monthName ) {
return getLocalizedMonthName(monthName, Locale.GERMAN);
}
public static String getLocalizedMonthName( final String monthName, final Locale locale ) {
if ( monthName == null || monthName.isBlank() ) {
return null;
}
try {
final Month month = Month.valueOf(monthName.toUpperCase());
Map<String, Integer> map = new HashMap<>();
map.put("Key1", 12);
map.compute("Key1", ( key, val ) -> (val == null) ? 1 : val + 1);
package com.example;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.IntStream;
import org.assertj.core.api.SoftAssertions;
import org.junit.jupiter.api.Test;
@manuelGitHub1
manuelGitHub1 / CredentialsDialog.java
Created April 11, 2022 08:13
Example for using two swing dialogs to capture login credentials
import javax.swing.*;
public class CredentialsDialog {
private String _email;
private String _password;
public String getEmail() {
return _email;
@manuelGitHub1
manuelGitHub1 / recipes.json
Created March 17, 2022 13:23
Input for a website. Recipes in json format (only ingredients)
[{"id":0,"name":"Gulasch","ingredients":[{"name":"Karoffeln","amount":200,"unit":"gram"},{"name":"Zwiebeln","amount":1,"unit":"pieces"},{"name":"Pilze","amount":100,"unit":"gram"},{"name":"Rindfleisch","amount":400,"unit":"gram"}]},{"id":1,"name":"Linsengemüse","ingredients":[{"name":"Linsen","amount":500,"unit":"gram"},{"name":"Zwiebeln","amount":1,"unit":"pieces"},{"name":"Lauch","amount":100,"unit":"gram"}]},{"id":2,"name":"Gemüseauflauf","ingredients":[{"name":"Karoffeln","amount":200,"unit":"gram"},{"name":"Lauch","amount":100,"unit":"gram"}]},{"id":3,"name":"Curry","ingredients":[{"name":"Karoffeln","amount":100,"unit":"gram"},{"name":"Lauch","amount":100,"unit":"gram"},{"name":"Kokosmilch","amount":1,"unit":"pieces"},{"name":"Hähnchen","amount":250,"unit":"gram"},{"name":"Paprika","amount":2,"unit":"pieces"}]}]
Open Powershell as Administrator
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Restart PC
Install a linux distribution from https://docs.microsoft.com/de-de/windows/wsl/install-win10
Update regularly sudo apt update && sudo apt upgrade
ls -v | cat -n | while read n f; do mv "$f" "$n.ext"; done
Eier
Milch
Käse