Kaynak: https://twitter.com/addyosmani/status/1223872295619330048
List<String> kurallar = Arrays.asList("ahmet", "veli", "mehmet");
List<String> sonuc = Arrays.asList("veli", "mehmet", "ahmet").stream()
.sorted(Comparator.comparing(isim -> kurallar.indexOf(isim)))
.collect(Collectors.toList());
assertThat(sonuc).isEqualTo(Arrays.asList("ahmet", "veli", "mehmet"));
Pass following as program an argument
java -jar app.jar -admin.port=:9999
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# USAGE: run-kibana.sh http://localhost:9200 | |
echo "Running kibana for es host:$1" | |
docker run --name kibana -d -p 5601:5601 \ | |
-e ELASTICSEARCH_HOSTS=$1 \ | |
-e XPACK_GRAPH_ENABLED=false \ | |
-e XPACK_ML_ENABLED=false \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create exchange | |
curl -i -u guest:guest -H "content-type:application/json" \ | |
-XPUT -d'{"type":"fanout","durable":true}' \ | |
http://localhost:15672/api/exchanges/%2f/my.exchange.name | |
# create queue | |
curl -i -u guest:guest -H "content-type:application/json" \ | |
-XPUT -d'{"durable":true,"arguments":{"x-dead-letter-exchange":"", "x-dead-letter-routing-key": "my.queue.dead-letter"}}' \ | |
http://localhost:15672/api/queues/%2f/my.queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Document | |
public class OrnekDokuman { | |
@Id | |
@GeneratedValue(strategy = GenerationStrategy.UNIQUE) // UUID | |
String id; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java -jar liquibase.jar \ | |
--driver=org.postgresql.Driver \ | |
--classpath=postgresql-9.4.1208.jre6.jar \ | |
--changeLogFile=/workspace/product-api/src/main/resources/db/changelog.xml \ | |
--url="jdbc:postgresql://localhost:5432/product" \ | |
--username=root \ | |
--password=123qwe \ | |
updateSQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
node { | |
stage('checkout') { | |
checkout scm | |
} | |
stage("Reindex") { | |
String esHost = params.esHost //example: localhost:9200 | |
String oldIndexVersion = params.oldIndexVersion //example: v1 | |
String newIndexVersion = params.newIndexVersion //example: v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
node { | |
stage('checkout') { | |
checkout scm | |
} | |
stage("Switch alias between index versions") { | |
String esHost = params.esHost //example: localhost:9200 | |
String oldIndexVersion = params.oldIndexVersion //example: v1 | |
String newIndexVersion = params.newIndexVersion //example: v2 |