Skip to content

Instantly share code, notes, and snippets.

// this code is the same as the servlet but for grovy console: https://github.com/OlsonDigital/aem-groovy-console
// OPTIONS
def PATH = '/content/dam'
def query = createQuery([path:PATH, type:'nt:file', 'p.limit':'99999999999999999'])
def result = query.getResult();
long totalSizeInKB = 0
result.getHits().each{
def node = it.node
@rwunsch
rwunsch / dispatcher.any
Created March 26, 2019 17:16 — forked from knennigtri/dispatcher.any
We.Retail dispatcher.any and httpd.conf
#To find the We.Retail Specific changes, search for "We.Retail Alert"
# Each farm configures a set of load balanced renders (i.e. remote servers)
/farms
{
# First farm entry
/website
{
# Request headers that should be forwarded to the remote server.
/clientheaders
mongouri="mongodb://<hostname-or-IP>:<port#>"
db="OakAuthor"
cache="256"
nodeCachePercentage="25"
prevDocCachePercentage="4"
childrenCachePercentage="10"
diffCachePercentage="5"
docChildrenCachePercentage="3"
cacheSegmentCount="16"
cacheStackMoveDistance="16"
@rwunsch
rwunsch / createUsers.sh
Created March 26, 2019 17:15 — forked from knennigtri/createUsers.sh
Autocreation of AEM users
#This script only creates users and a single group. This does not set permissions or put the users into the group.
#Once this script is run, go to /useradmin and add all created AEM users to the created AEM group
#Open the created group and add Groups: Authors, DAM-users, tag-administrators, project-administrators, template-authors, workflow-administrators, /libs/cq/core/content/nav/personalization (full permissions)
#Number of AEM Accounts to be created
STUDENTS=13
#Name of group being created
GROUP=mygroup
#Name of AEM users
@rwunsch
rwunsch / .java-6-oracle.jinfo
Created October 25, 2018 11:49 — forked from ApprenticeGC/.java-6-oracle.jinfo
Download java SE 6 update 30 from Oracle.
name=java-6-oracle
alias=java-6-oracle
priority=63
section=non-free
jre ControlPanel /usr/lib/jvm/java-6-oracle/jre/bin/ControlPanel
jre java /usr/lib/jvm/java-6-oracle/jre/bin/java
jre java_vm /usr/lib/jvm/java-6-oracle/jre/bin/java_vm
jre javaws /usr/lib/jvm/java-6-oracle/jre/bin/javaws
jre jcontrol /usr/lib/jvm/java-6-oracle/jre/bin/jcontrol
@rwunsch
rwunsch / sessionSummary.groovy
Created November 14, 2017 15:11 — forked from badvision/sessionSummary.groovy
Summarize all open JCR sessions by the stack trace of the code that opened them. This helps identify session leaks in code.
import groovy.json.JsonSlurper
//Get data from here: /system/sling/monitoring/mbeans/org/apache/jackrabbit/oak/%2522SessionStatistics%2522.2.json
def file = '/Users/brobert/Desktop/all_sessions.json' as File
def sanitizeStacktrace = {trace->
if (trace.contains("loginAdministrative")) {
def lines = trace.split("\n")
def startIdx;
for (def idx=0; idx < lines.length; idx++) {
@rwunsch
rwunsch / bundle.info
Created January 23, 2017 09:52 — forked from chetanmeh/bundle.info
Felix 4.x bundle.info description
11 #Bundle Id
slinginstall:/path/to/foo.jar #Bundle original location
32 #Persistence State (INSTALLED, RESOLVED etc)
1 #Start level
1358768421064 #Last modified
0 #Refresh Count
@rwunsch
rwunsch / curlPackageFilterRules.sh
Created January 17, 2017 11:19 — forked from nateyolles/curlPackageFilterRules.sh
AEM/CQ cURL: Adding include/exclude rules to package filters
# Adding include/exclude rules to CQ/AEM package filters through cURL.
# Through a simple search, you will find numerous lists of CQ/AEM cURL commands.
# However, I haven't seen an example of adding rules to package filters. The
# JSON "rules" key takes an array value. You can leave the array empty if you
# don't need to include any rules. The array is of JSON objects with a
# "modifier" key and value of "include" or "exclude", and a "pattern" key with
# your path or regular expression as the value.
# create package
@rwunsch
rwunsch / Oak-mongo.js.md
Last active January 19, 2017 16:29 — forked from chetanmeh/README.md
Utility JS function for Mongo when used with Jackrabbit Oak

Following js file can be load at start of mongo shell and then the functions can be accessed

$ wget https://gist.githubusercontent.com/chetanmeh/836ca8fffc4c410daed2/raw/oak-mongo.js
$ mongo localhost/oak --shell oak-mongo.js
MongoDB shell version: 2.6.3
connecting to: localhost/oak
type "help" for help
> oak.countChildren('/oak:index/')
356787

> oak.getChildStats('/oak:index')

@rwunsch
rwunsch / CQ_AEM_CURL_COMMANDS.txt
Last active January 19, 2017 16:28 — forked from sergeimuller/gist:2916697
CQ5 curl commands
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F