Skip to content

Instantly share code, notes, and snippets.

@davidjgonzalez
davidjgonzalez / mavenize-cq5-dependencies
Created February 26, 2012 21:09 — forked from kurtharriger/mavenize-cq5-dependencies
This script will download all crxde classpath dependencies and install them in your local maven repository
#! /bin/bash
set -e
trap "exit 1;" INT TERM EXIT
# exec > >(tee $0.log)
# exec 2>&1
[ -z "$CRX_URL" ] && CRX_URL=http://localhost:4502
[ -z "$CRX_CREDENTIALS" ] && CRX_CREDENTIALS=admin:admin
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"
Upload a package AND install
curl -u admin:admin -F file=@"name of zip file" -F name="name of package"
import java.io.IOException;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
public class Test {
var debugEnabled = false
var infoEnabled = true
var traceEnabled = false
//Maximum number of live paths to determine when a leak object is found
var maxPathsToFound = 1
//No of object instances after which a progress message
//is logged
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
export JAVA_HOME=`/usr/libexec/java_home -v $@`
export PATH=$JAVA_HOME/bin:$PATH
fi
}
<%@include file="/libs/foundation/global.jsp"%><%
%><%@page session="false" contentType="text/html; charset=utf-8"
pageEncoding="UTF-8"
import="org.apache.sling.api.resource.*,
com.day.commons.datasource.poolservice.DataSourcePool,
javax.sql.*,
java.sql.*,
java.util.*,
javax.jcr.*,
@davidjgonzalez
davidjgonzalez / debug-aem.sh
Last active July 24, 2016 15:22
Shortcut script for starting (random) AEM with intellij debug enabled
#!/bin/bash
# sudo vi /usr/local/bin/debug-aem.sh <- this file
# chmod a+x /usr/local/bin/debug-aem.sh
# debug-aem.sh <jar-file> <debug-port>
java -Xdebug -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${2:-8888} -jar ${1:-cq-author-p4502.jar}
@davidjgonzalez
davidjgonzalez / oak-browse-tree.groovy
Created April 28, 2017 18:41 — forked from alexkli/oak-browse-tree.groovy
Groovy script for displaying hidden Oak content structures
// --------------------------------------------------------------
// change these input values
// path: what oak path to show
def path = "/oak:index/nodetype/:index";
// depth: how deep the tree structure should be rendered
def depth = 2;
// --------------------------------------------------------------
@davidjgonzalez
davidjgonzalez / gist:38550e36e66be3c234c6944fabf67d8f
Created June 23, 2017 21:01
SlingContextBuilder with Mapping
SlingContextBuilder slingContextBuilder = new SlingContextBuilder(ResourceResolverType.RESOURCERESOLVER_MOCK);
SlingContext context = slingContextBuilder.resourceResolverFactoryActivatorProps(ImmutableMap.<String, Object>builder()
.put("resource.resolver.mapping", new String[]{"/:/", "/content/test/</"})
.build())
.resourceResolverType(ResourceResolverType.RESOURCERESOLVER_MOCK)
.build();
context.create().resource("/content/test/simple", "sling:vanityPath", "/my-vanity");