Skip to content

Instantly share code, notes, and snippets.

@sekaiser
sekaiser / cluster.yaml
Last active March 20, 2024 08:31
flink application mode kustomize
apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
name: cluster
namespace: flink
spec:
image: flink:1.18.1-java17
flinkVersion: v1_19
flinkConfiguration:
taskmanager.numberOfTaskSlots: "2"
@sekaiser
sekaiser / UsernameGenerator
Last active August 7, 2023 15:22
Simple username generator for Spring Boot
package sekaiser;
import org.springframework.stereotype.Component;
import java.util.Locale;
import java.util.concurrent.ThreadLocalRandom;
@Component
public final class UsernameGenerator {
private static final String[] ADJECTIVES;
# display VPC ID, CIDR Block and Name
aws ec2 --output text --query 'Vpcs[*].{VpcId:VpcId,Name:Tags[?Key==`Name`].Value|[0],CidrBlock:CidrBlock}' describe-vpcs
# display VPC ID, IPv6 CIDR Block and Name\
aws ec2 describe-vpcs --query 'Vpcs[*].{VpcId:VpcId,Name:Tags[?Key==`Name`].Value|[0],Ipv6CidrBlock:Ipv6CidrBlockAssociationSet[0].Ipv6CidrBlock}'
@sekaiser
sekaiser / gist:64634824328dd861ebe2e1c833ee1ea1
Created April 1, 2021 21:25
editing pom files with xmlstarlet
#!/usr/bin/env bash
set -euo pipefail
if [ $# -eq 0 ]; then
pom_file="pom.xml"
else
pom_file=$1
fi
# sort a pom (https://github.com/Ekryd/sortpom)
mvn com.github.ekryd.sortpom:sortpom-maven-plugin:sort -Dsort.keepBlankLines -Dsort.predefinedSortOrder=custom_1
# Dasel
https://github.com/TomWright/dasel#property
# Select dependency by groupId
go run github.com/tomwright/dasel/cmd/ put object -f pom.xml -p xml '.project.dependencies.dependency.(groupId=org.assertj)'
# Append a new dependency
go run github.com/tomwright/dasel/cmd/ put object -f pom.xml -s '.project.dependencies.dependency.[]' -t string "groupId=some.groupId" -t string "artifactId=some.artifactId" -t string "version=1.0.0"
macro_rules! from {
($(@$f: ident
$( ?> $i1: ident = $e1: tt )*
$( => $t: ident )*
$( -> $i2: ident = $e2: tt )* )*) => (
$($(
impl <'g> From<$f<'g>> for $t<'g> {
fn from(f: $f<'g>) -> Self {
Self {
request: f.request,
# Foundations
A startup's mission is the search of a business model that is repeatable and
scalable. The search for such a business model must follow the scientific method,
which is based on one or several testable hypotheses and the empirical
validation of such hypotheses through experiments and result analysis.
If the company succeeds in defining such a business model, it is considered a
success. If it fails, the organization may cease to exist.
As failing may cause the end of the organization, the startup is under immense
pressure to quickly iterate upon ideas, gain relevant knowledge and to define
@sekaiser
sekaiser / typescript_react_defaultProps.ts
Last active August 24, 2018 08:49
How to deal with default properties in React when building stuff in Typescript (> v3.0)
--- utility
/**
* Ensure to properly deal with default props in React.Component
*/
export const createPropsGetter = <DP extends object>(defaultProps: DP) => {
return <P extends Partial<DP>>(props: P) => {
// extract default props from component Props and type
type PropsExcludingDefaults = Pick<P, Exclude<keyof P, keyof DP>>;