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
# Source: https://gist.github.com/6039be2497217a555fba5eafea076ba3 | |
######################################################################### | |
# Werf: Glue Together Git, Docker, Helm, Kubernetes For CI/CD Pipelines # | |
# https://youtu.be/WM06S_ltcVs # | |
######################################################################### | |
# Additional Info: | |
# - werf: https://werf.io | |
# - GitHub CLI - How to manage repositories more efficiently: https://youtu.be/BII6ZY2Rnlc |
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
serverless create \ | |
--template google-nodejs \ | |
--path gcp-function | |
cd gcp-function | |
ls -1 | |
cat index.js |
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
# Source: https://gist.github.com/5b3cd6f336e2d9e6682c1a1792c860d0 | |
#################### | |
# Creating Cluster # | |
#################### | |
# Docker for Desktop with Istio: https://gist.github.com/d9b92a8e03c2403624fcef25f3fcd4e5 | |
# minikube with Istio: https://gist.github.com/01f562077f31750d24c8b7ef5b3ae4d0 | |
# GKE with Istio: https://gist.github.com/80c379849b96f4ae5a2ccd30d843f205 | |
# EKS with Istio: https://gist.github.com/957971fe8664de180ecc466a8da6017d |
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
# Setup Cluster | |
for i in 1 2 3; do | |
docker-machine create -d virtualbox swarm-$i | |
done | |
eval $(docker-machine env swarm-1) | |
docker swarm init --advertise-addr $(docker-machine ip swarm-1) |
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
package net.aquadc.util; | |
import java.util.Comparator; | |
import java.util.Objects; | |
import java.util.Optional; | |
import java.util.stream.Collector; | |
/** | |
* Stats of a stream of objects, including {@linkplain #size()}, {@linkplain #min()}, and {@linkplain #max()}. | |
* <p>This is intended to be used with {@link java.util.stream.Stream#collect}, for example</p> |
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
import java.util.Collection; | |
import java.util.Comparator; | |
import java.util.Deque; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.ListIterator; | |
import java.util.NavigableSet; | |
import java.util.Queue; | |
import java.util.Set; | |
import java.util.SortedSet; |
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(?) way | |
interface Fraction<E extends Exception> { | |
int numerator() throws E; | |
int denominator() throws E; | |
} | |
class FracStatic implements Fraction<RuntimeException> // don't force catching | |
class FracSum<E1, E2> implements Fraction<EitherException<E1, E2>> // impossible due to type erasure | |
// Kotlin, Scala, Rust way |
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
package net.aquadc.util; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.Collections; | |
import java.util.List; | |
/** | |
* For lists with O(n) random-deletion time (array-based lists, like {@link ArrayList}), | |
* it's faster to mark items as removed and them sweep them all together. |
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
final Map<Employee.Sex, Optional<Employee>> youngestEmployeeBySex = employees.stream() | |
.collect(groupingBy(Employee::getSex, minBy(comparing(Employee::getAge)))); |
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
final Map<Employee.Sex, List<Employee>> employeesOverThirtyBySex = employees.stream() | |
.collect(groupingBy(Employee::getSex, filtering(employee -> employee.getAge() > 30, toList()))); |
OlderNewer