Skip to content

Instantly share code, notes, and snippets.

@andrewmkhoury
andrewmkhoury / findLargeBinaries.groovy
Created May 5, 2020 21:18
Apache Oak Groovy Script to find large binary properties in Oak JCR
//Adaptation of @stillalex's script from here https://gist.github.com/stillalex/06303f8cc1d3780d3eab4c72575883ae
//This version works with Oak 1.6 and later versions
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicInteger
import org.apache.jackrabbit.oak.api.Type
import org.apache.jackrabbit.oak.spi.state.NodeState
import org.apache.jackrabbit.oak.spi.state.NodeStore
import org.apache.jackrabbit.oak.commons.PathUtils
import com.google.common.collect.Lists
import java.util.List
@wpscholar
wpscholar / grep-status-codes.sh
Last active October 6, 2023 17:46
How to use grep to lookup status codes in access logs.
# Output the access log
cat access.log
# Run the results through grep to find any 500 status codes
cat access.log | grep "[: ]500[: ]"
# Find any non 200 status codes
cat access.log | grep -v "[: ]200[: ]"
# Find multiple status codes

The objective here is to find all SegmentNotFoundException type corruption and remove it (as we don't have a valid backup)

Before running any of the below steps we created an index.json file (see the file below) which contains only the index definitions of the corrupted indexes.

  1. This generates the file indexing-results\index-definities.json
java -Xmx8g -jar oak-run-1.8.12.jar index --fds-path=crx-quickstart\repository\datastore crx-quickstart\repository\segmentstore --index-definitions
  1. From that file we copied only the definitions we needed and created index.json (file attached here )
@andrewmkhoury
andrewmkhoury / 1 - Fix Versions.md
Last active July 28, 2021 05:26
Fix Corrupt Jackrabbit Oak Version Histories
@dhavaln
dhavaln / IAMCredentials.json
Created December 22, 2018 11:06 — forked from ServerlessBot/IAMCredentials.json
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",

Breaklets

The Idea

Breaklets are a way to check limits of a platform/aspect/tool. Breaklets

  • ... iteratively make things worse
  • ... run until either
    • a threshold is reached
@thesurenk
thesurenk / filter.xml
Created May 16, 2018 14:59
vlt export command script and filter.xml using the same destination folder on adobe experience manager (aem)
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/content">
<exclude pattern="/content/jcr:system"/>
<exclude pattern="/content/var/classes"/>
<exclude pattern="^.*/rep:accessControl"/>
</filter>
</workspaceFilter>
// gulpfile.js
var namespace = 'gulp-flow';
var gulp = require('gulp'),
watch = require('gulp-watch'),
gutil = require('gulp-util'),
plumber = require('gulp-plumber'),
slang = require('gulp-slang'),
debug = require('gulp-debug'),
@kevinweber
kevinweber / _cq_dialog.xml
Last active February 21, 2023 14:44
AEM: Sling Resource Merging & Includes (dialog, inheriting properties)
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured">
<content jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">
<basic jcr:primaryType="nt:unstructured">
<items jcr:primaryType="nt:unstructured">
<column jcr:primaryType="nt:unstructured">
Standard:
-Xmx -- Increase heap size to 50% total machine ram, or 24gb -- whichever is smaller
-XX:+UseG1GC -- More efficient server GC in Java 8
-XX:+UseAES -XX:+UseAESIntrinsics -- Use Hardware crypto features for AES if available
-XX:+AggressiveOpts -- Experimental faster JVM tunings
-Djava.awt.headless=true -- Required for headless unix boxes for Java2D support to work properly
-Djava.io.tmpdir=/tmp -- Recommended to set somewhere with fast i/o
Debugging:
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -- Used for triaging heap full errors