Skip to content

Instantly share code, notes, and snippets.

View mkuehle's full-sized avatar
🏠
Working from home

Markus Kühle mkuehle

🏠
Working from home
View GitHub Profile
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@mkuehle
mkuehle / beispiele_automatische_datentypen.dart
Created October 28, 2019 16:45
Beispiele für automatische Typisierung bei Variablen
var count = 0; // int
var message = 'hello world'; // string
var primzahlen = [2, 3, 5, 7, 11]; // Liste von int
var haustiere = {'Hund', 'Katze', 'Maus', 'Hase'}; // Set von strings
var loading = false; // bool
@mkuehle
mkuehle / beispiele_statische_datentypen.dart
Created October 28, 2019 08:44
Beispiele für statsische Typisierung bei Variablen
var int count = 0; // int
var string message = 'hello world'; // string
var List<int> primzahlen = [2, 3, 5, 7, 11]; // Liste von int
var Set<String> haustiere = {'Hund', 'Katze', 'Maus', 'Hase'}; // Set von strings
var bool loading = false; // bool
@mkuehle
mkuehle / dart_runes_type.dart
Created October 6, 2019 20:40
Dart Rune Type
void main() {
Runes input = new Runes('\u{1f600}' '\u{1f499}' '\u{1f44d}');
print(new String.fromCharCodes(input));
}
@mkuehle
mkuehle / AmazonRdsSnapshotService.java
Created May 1, 2019 06:47
Auf den Status available warten während die RDS Instanz erstellt wird
public DBInstance getRdsInstance(String dbInstanceIdentifier) {
AmazonRDS client = createAmazonRdsClient();
DescribeDBInstancesRequest describeDBInstancesRequest = new DescribeDBInstancesRequest()
.withDBInstanceIdentifier(dbInstanceIdentifier);
DescribeDBInstancesResult describeDBInstances = client.describeDBInstances(describeDBInstancesRequest);
client.shutdown();
return describeDBInstances.getDBInstances().get(0);
}
private void waitUntilRdsInstanceIsAvailable(DBInstance instance) {
@mkuehle
mkuehle / AmazonRdsSnapshotService.java
Created May 1, 2019 06:40
Amazon RDS Instanz mit Snapshot ID erstellen
private DBInstance createRdsInstance(String snapshotIdentifier) {
String newRdsInstanceId = "mk-dev-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMdd-HHmm"));
logger.info("Erstelle neue RDS Stage Instance mit ID: {}", newRdsInstanceId);
AmazonRDS client = createAmazonRdsClient();
RestoreDBInstanceFromDBSnapshotRequest request = new RestoreDBInstanceFromDBSnapshotRequest()
.withPubliclyAccessible(true)
.withDBInstanceIdentifier(newRdsInstanceId)
.withDBSnapshotIdentifier(snapshotIdentifier)
.withMultiAZ(false)
@mkuehle
mkuehle / AmazonRdsSnapshotService.java
Created May 1, 2019 06:35
Amazon API RDS Client erstellen
private AmazonRDS createAmazonRdsClient() {
BasicAWSCredentials basicCredentials = new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_KEY);
AWSStaticCredentialsProvider credentialProvider = new AWSStaticCredentialsProvider(basicCredentials);
return AmazonRDSClientBuilder.standard()
.withRegion(Regions.EU_CENTRAL_1)
.withCredentials(credentialProvider)
.build();
}
@mkuehle
mkuehle / AmazonRdsSnapshotService.java
Created May 1, 2019 05:45
Aktuellsten RDS Snapshot Identifier herausbekommen
AmazonRDS client = createAmazonRdsClient();
DescribeDBSnapshotsRequest describeDBSnapshotsRequest = new DescribeDBSnapshotsRequest();
describeDBSnapshotsRequest.withSnapshotType("automated");
describeDBSnapshotsRequest.setDBInstanceIdentifier(RDS_INSTANCE_IDENTIFIER);
List<DBSnapshot> snapshots = client.describeDBSnapshots(describeDBSnapshotsRequest).getDBSnapshots();
logger.info("{} RDS Snapshots gefunden für RDS Instance ID '{}'", snapshots.size(), RDS_INSTANCE_IDENTIFIER);
client.shutdown();
@mkuehle
mkuehle / HTMLBuddyTest.java
Last active July 1, 2017 09:14
static imports JUnit Test
package de.ligahero.news.control;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
public class HTMLBuddyTest {
@Test
@mkuehle
mkuehle / Bonusfrage.java
Last active May 21, 2017 13:58
Javadoc {@link } Verwendung
/**
* <p>
* Beschreibt eine Bonusfrage wie z.B. "Wer wird Meister".
* </p>
*
* <p>
* Ist die Bonusfrage von LigaHero vorgegeben, ist das Attribut {@link #customQuestion} <code>true</code>, bei einer von einer Tipprunde selbst erstellten Frage
* <code>false</code>.<br/>
* Mit der Methode {@link #setCustomQuestion(boolean)} kann der Wert gesetzt werden.
* </p>