Archive for the ‘Cheat Sheets’ Category

Pandoc

Convert Markdown to Slides

  1. Write Markdown, using headings to chunk your file into sections. Each heading will be its own slide.
  2. Annotate the markdown file with YAML by adding a document header:
title:
 - RAG Pipeline
author:
 - Bobby Ratliff
theme: 
 - Copenhagen
date:
 - March 4, 2026

Then convert the markdown file to html:

pandoc -t slidy -s rag-pipeline.txt -o rag-pipeline.html

For more information, see the Pandoc Manual.

Convert Markdown to PDF

Install dependencies

brew install pandoc
brew install --cask basictex
# Ensure latex utilities are on the PATH
eval "$(/usr/libexec/path_helper)"

Convert the document

pandoc -s 'rag pipeline.md' -o 'rag pipeline.pdf'

Spring Boot Cheat Sheet

Spring Cloud Config

Web Debug

Example: Log the reason a 400 bad request is being produced. This will log which ControllerAdvice method is being called.

logging.level.org.springframework.web.servlet.mvc.method.annotation=DEBUG

Database Debug

spring.jpa.show-sql=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
logging.level.org.springframework.transaction=TRACE
logging.level.org.springframework.jdbc.core=TRACE

Security Debug

logging.level.org.springframework.security=DEBUG
logging.level.org.springframework.web=DEBUG

Java on Mac Cheat sheet

Install AdoptOpenJDK following instructions for macOS. The instructions don’t say where to install it, I suggest /Library/Java/JavaVirtualMachines. This will get you the built-in mac behavior.

Built-in mac behavior

Older versions of Java created a Java button in System Preferences. It will not show Java 11, but it will show older versions. In my case, I had some old projects using Java 8.

The other built-in is the java_home utility.

List available versions

alias javas_avail='/usr/libexec/java_home -V'

Example output:

Matching Java Virtual Machines (2):
11.0.1, x86_64: "OpenJDK 11.0.1" /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
1.8.0_161, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home

Switch to a specific version

java_home will also allow you to switch to a given version. For example

$ export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
$ java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

If you find yourself switching versions a lot, create an alias for it.

Docker cheat sheet

docker run = new container (specify image name)

docker exec = run a command in an existing container

How to turn a docker run command into an interactive shell:

-it --entrypoint=/bin/sh

Note, you have to add that before the name of the image.

Cleanup images

To filter down the images and only clean those matching some-text, use:

docker images | grep some-text | awk '{ print $1 ":" $2}' | xargs docker rmi

Cleanup orphaned images

Sometimes images are orphaned, for example, if you tagged an image as latest, and then built a new image with that same tag. They will show up as <none> in docker images. They can be cleaned up using:

docker rmi $(docker images -f "dangling=true" -q)

List images by size

docker images --format '{{.Size}}\t{{.Repository}}' | sort -hr