Skip to content

Instantly share code, notes, and snippets.

@joemaffia
joemaffia / GoodbyeWorldService.java
Last active December 25, 2015 16:19
Adobe CQ OSGi service using SCR annotations.
package com.company.cq.services;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.osgi.framework.Constants;
/**
@joemaffia
joemaffia / GoodbyeWorldServlet.java
Created October 16, 2013 09:12
Adobe CQ Servlet that will expose the GoodbyeWorldService
package com.company.cq.servlets;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;
import org.slf4j.Logger;
@joemaffia
joemaffia / bash_profile
Last active December 6, 2021 17:14
Set $JAVA_HOME Environment Variable On Mac OS X
# OSX 10.5 or later Apple recommends to set the $JAVA_HOME variable to /usr/libexec/java_home
# so just export $JAVA_HOME in file ~/.bash_profile or ~/.profile or ~/.zshrc
# /usr/libexec/java_home return the Java version specified in Java Preferences for the current user.
export JAVA_HOME=$(/usr/libexec/java_home)
#specific version
#export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
@joemaffia
joemaffia / aem-import-json.sh
Created February 4, 2015 13:26
Import json to JCR via bash
#!/bin/bash
if (( $# < 1 ))
then
echo "You should add more stuff ;)"
echo "example: $0 ~/Desktop/file.json http://localhost:4502/content/copy"
exit 1
fi
j="$1"
@joemaffia
joemaffia / toggle-touch-classic.js
Created February 6, 2015 13:52
Bookmarklet to switch between Touch & Classic edit mode in AEM
javascript:(function(){
var TOUCH = '/editor.html';
var CLASSIC = '/cf';
var createURL = function(path, qs, hash) {
var url = path;
if(qs.length != 0 && !(qs.length == 1 && qs[0] == '')) {
url += '?' + qs.join('&');
}
url += hash;
@joemaffia
joemaffia / lwip.js
Last active August 29, 2015 14:18
Node ExpressJS using LWIP
var app = require('express')();
var multer = require('multer')
var lwip = require('lwip')
app.use(multer({inMemory: true}))
app.post('/', function (req, res) {
var fileBuffer = req.files.file.buffer
lwip.open(fileBuffer, 'jpg', function(err, image) {
@joemaffia
joemaffia / brew
Created July 13, 2015 08:47
Homebrew permissions & multiple users needing to brew update
chgrp -R admin /usr/local
chmod -R g+w /usr/local
chgrp -R admin /Library/Caches/Homebrew
chmod -R g+w /Library/Caches/Homebrew
@joemaffia
joemaffia / AEM cURL
Last active February 27, 2025 19:28
AEM cURL commands
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
bundlefile=@"name of jar.jar" http://localhost:4505/system/console/bundles
Build a bundle
curl -u admin:admin -F bundleHome=/apps/centrica/bundles/name of bundle -F
descriptor=/apps/centrica/bundles/com.centrica.cq.wcm.core-bundle/name_of_bundle.bnd
@joemaffia
joemaffia / AEM Querybuilder | not Active pages
Created December 16, 2015 10:11
AEM Querybuilder | not Active pages
http://localhost:4502/bin/querybuilder.json?
type=cq:Page&
path=/content/geometrixx/en/products/triangle&
group.p.or=true&
group.1_property=jcr:content/cq:lastReplicationAction&
group.1_property.value=Deactivate&
group.2_property=jcr:content/cq:lastReplicationAction&
group.2_property.operation=not
@joemaffia
joemaffia / aem-content-refresh.sh
Created December 1, 2016 12:50
AEM Content Refresh via packmgr
#!/bin/bash
############ log file configuration ##############
LOG_DIR="./"
today=$(date +"%Y-%m-%d")
logfile="$LOG_DIR/aem-content-refresh.log.$today"
############ Environment connections ##############
# Source Author Slave
SOURCE_AUTH_LOGIN="admin"