Skip to content

Instantly share code, notes, and snippets.

@rajeshp
rajeshp / findKthSmallest.java
Created January 16, 2013 19:52
Code to find the Kth Smallest element from 2 Independently Sorted Arrays
//take 2 pointers p1 and p2 which points to arrays A and B respectively and compare a[p1] to b[p2], if smaller increment p1 else increment p2
static int getKthSmallest(int[] a, int[] b, int k)
{
if(a==null || b==null || k> (a.length+b.length))
throw new IllegalArgumentException();
int p1=0,p2=0,i=0;
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
+-----------------------+
| /etc/rc.d/init.d/cq5 |
+-----------------------+
#!/bin/bash
#
# cq5 Startup script for Adobe AEM/CQ5
#
# chkconfig: 345 80 20
# description: Startup script for Adobe AEM/CQ5
// paste the following into a new bookmark called CQ5 Preview
javascript:(function(){
function updateQueryStringParameter(uri, key, value) {
var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i");
separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, '$1' + key + "=" + value + '$2');
}
else {
return uri + separator + key + "=" + value;
@rajeshp
rajeshp / gist:81d3cd991a9d200f38c3
Created November 8, 2014 12:26
maven archetype for new cq5 project
mvn archetype:generate -DarchetypeGroupId=com.day.jcr.vault -DarchetypeArtifactId=multimodule-content-package-archetype -DarchetypeVersion=1.0.0 -DarchetypeRepository=adobe-public-releases
@rajeshp
rajeshp / pr.md
Last active August 29, 2015 14:15 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@rajeshp
rajeshp / pr.md
Last active August 29, 2015 14:19 — forked from kennethreitz/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@rajeshp
rajeshp / jcr-locations.md
Created September 25, 2017 21:25 — forked from knennigtri/jcr-locations.md
Useful JCR Locations for AEM Templates and components