Java Bean Mapping with MapStruct

MapStruct is a nice tool to generate mappers for converting one Java bean into another e.g. for projections, data-transfer-objects and so on …​ As long as fields in source and target beans do match, the mapper is able to generate the data setting automatically .. else we may specify which source fields to map into which target fields or to register custom converters with ease. Using Maven, we need to add dependencies and plugin integration to our pom.xml: ...

March 31, 2022 · 3 min · 459 words · Micha Kops

AsciiDoc Snippets

AsciiDoc Syntax and Features Using AsciiMath Include stem into document header :stem: Then use inline, e.g.: stem:[sqrt(4) = 2] or as block [stem] ++++ sum_(i=1)^n i^3=((n(n+1))/2)^2 ++++ AsciiMath Syntax Collapsible Blocks/Sections .Click to show the content [%collapsible] ==== Long content here... ==== Source: Asciidoctor Docs Tools and Ecosystem Docker / Podman Container Including stuff like: Asciidoctor Asciidoctor Diagram with ERD and Graphviz integration (supports plantuml and graphiz diagrams) Asciidoctor PDF Asciidoctor EPUB3 Asciidoctor FB2 Asciidoctor Mathematical Asciidoctor reveal.js AsciiMath Source highlighting using Rouge, CodeRay or Pygments Asciidoctor Confluence Asciidoctor Bibtex Asciidoctor Kroki Asciidoctor Reducer ...

May 10, 2019 · 1 min · 171 words · Micha Kops

Docker Snippets

Restrict Network Can be useful when using a third-party image that we do not trust Run with no network docker run --network none <image> Run with private isolated network At least containers attached to this network can talk with another docker network create --internal my_isolated_network docker run --network my_isolated_network <image> Block using firewall e.g. using iptables or ipfw # Get container's IP docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_name> # Block all outbound connections from that IP sudo iptables -I DOCKER-USER -s <container_ip> -j DROP ...

March 1, 2010 · 3 min · 452 words · Micha Kops