Skip to content

Instantly share code, notes, and snippets.

@stillalex
stillalex / childCountWarning.groovy
Created June 20, 2016 08:50
counts number of nodes in tree, logging a warn is the number of child nodes exceeds a certain threshold
import java.util.concurrent.atomic.AtomicInteger
import org.apache.jackrabbit.oak.api.Type
import org.apache.jackrabbit.oak.plugins.segment.SegmentBlob
import org.apache.jackrabbit.oak.spi.state.NodeState
def countNodes(NodeState n, String path = "/", Integer flush = 1000000, Long warnAt = 1000, AtomicInteger count = new AtomicInteger(0), AtomicInteger binaries = new AtomicInteger(0), root = true) {
if(root) {
println "Counting nodes in tree ${path}"
}
@andrewmkhoury
andrewmkhoury / ClonedReindexingInstructions.md
Last active April 29, 2021 08:20
Reindexing Oak Async Indexes on a Clone AEM Instance

How to Reindex AEM on a Clone Instance and Sync over the Changes

  1. Clone your AEM instance to another VM for reindexing
  2. Download these oak-run jars:
  1. Upload the oak-run jars to the clone server
  2. Stop AEM (stop all AEM instances if a cluster or cold standby)
  3. Run this command (using oak-run-1.6.6.jar)
  • java -Xmx4096m -jar oak-run-1.6.6.jar checkpoints /path/to/repository/segmentstore
  1. Run this command (using oak-run-1.6.6.jar)
@stillalex
stillalex / logging.md
Last active March 12, 2022 15:33
TarMk Cold Standby Logging

TarMk Cold Standby Logging Tips

StandbyClientHandler

Enable DEBUG logs on org.apache.jackrabbit.oak.plugins.segment.standby.client.StandbyClientHandler

This will only log the start and the end of the sync cycle, no progress indication logged.

You'll get the following:

@stillalex
stillalex / rmNode.groovy
Created November 21, 2014 19:16
Groovy script to remove a node at a given path
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook
import org.apache.jackrabbit.oak.spi.state.NodeStore
import org.apache.jackrabbit.oak.commons.PathUtils
def rmNode(def session, String path) {
println "Removing node ${path}"
NodeStore ns = session.store
def nb = ns.root.builder()
@plepe
plepe / gist:52ecc9f18efb32c68d18
Last active August 22, 2025 19:15
MDADM and LVM cheat sheet

mdadm

Glossary:

  • md: multiple devices
command description
cat /proc/mdstat show status of all raids
mdadm --detail /dev/md0 detailed status of raid md0
convert original.jpg +profile icm -profile JapanColor2001Coated.icc -profile AdobeRGB1998.icc output.jpg