Instantly share code, notes, and snippets.

View tunneling.servlet.shared.secret.groovy
/**
https://dev.liferay.com/en/discover/portal/-/knowledge_base/7-0/enabling-remote-live-staging
tunneling.servlet.shared.secret=6162636465666768696a6b6c6d6e6f70
tunneling.servlet.shared.secret.hex=true
**/
import com.liferay.portal.kernel.security.pwd.*
import com.liferay.portal.util.*
try {
View TUnnel
import com.liferay.portal.kernel.security.pwd.*
try{
String algorithm = PasswordEncryptorUtil.getDefaultPasswordAlgorithmType();
out.println("Algorithm"+algorithm);
String pwdEnc = PasswordEncryptorUtil.encrypt("TEXTTEXTTEXT");
out.println("Password encrypted:"+pwdEnc);
String hexPwd = org.apache.commons.codec.binary.Hex.encodeHexString(pwdEnc.getBytes());
View TUnnel
import com.liferay.portal.kernel.security.pwd.*
try{
String algorithm = PasswordEncryptorUtil.getDefaultPasswordAlgorithmType();
out.println("Algorithm"+algorithm);
String pwdEnc = PasswordEncryptorUtil.encrypt("TEXTTEXTTEXT");
out.println("Password encrypted:"+pwdEnc);
String hexPwd = org.apache.commons.codec.binary.Hex.encodeHexString(pwdEnc.getBytes());
View skype-query.sql
cd /Users/corne/Library/Application\ Support/Skype/corne.aussems/
cp main.db main-bak.db
sqlite3 main-bak.db
/** pretty print **/
sqlite3 -separator $'\t' -header -cmd '.mode columns' main-bak.db ;
/** You want to know what you wrote in each Conversation last 2 days **/
SELECT displayname,from_dispname, datetime(Messages.timestamp, 'unixepoch') AS date, body_xml
FROM Messages LEFT JOIN Conversations on Messages.chatname = Conversations.identity
WHERE Messages.timestamp BETWEEN strftime('%s','now', '-2 days') AND strftime('%s','now')
View Liferay Groovy output file
#############
import com.liferay.portal.kernel.service.*;
import com.liferay.portal.kernel.dao.orm.*;
final def SCRIPT_ID = "MYSCRIPT"
outputFile = new File("""${System.getProperty("liferay.home")}/logs/out-${SCRIPT_ID}.txt""")
out.println(outputFile.text)
View JournalFolderTree.groovy
import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portlet.journal.service.*;
import com.liferay.journal.service.impl.*;
import com.liferay.journal.service.*;
import com.liferay.portal.kernel.service.*;
import com.liferay.portal.kernel.dao.orm.*;
final def SCRIPT_ID = "MYSCRIPT1"
outputFile = new File("""${System.getProperty("liferay.home")}/scripting/out-${SCRIPT_ID}.txt""")
View .groovy
import java.util.ArrayList
import java.util.Iterator
import java.util.List
import java.util.ListIterator
import com.liferay.portal.service.ResourcePermissionLocalServiceUtil
import com.liferay.portal.service.RoleLocalServiceUtil
import com.liferay.portal.model.ResourceConstants
import com.liferay.portal.model.ResourcePermission
import com.liferay.portal.model.Role
View Liferay Groovy update Agreed To Terms Of Use
//import com.liferay.portal.service.ServiceContext;
//import com.liferay.portal.util.*;
//import com.liferay.portal.service.*;
//import com.liferay.portal.service.impl.*;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.util.*;
import com.liferay.portal.kernel.service.*;
import com.liferay.portal.kernel.service.impl.*;
View regex
<INTERN_NUMMER>(.*)</INTERN_NUMMER>\n^(.*)<ACHTERNAAM>Diwali</ACHTERNAAM>\n^(.*)<VOORNAAM>Sunder</VOORNAAM>\n^(.*)<GESLACHT>V</GESLACHT>\n^(.*)<TAAL>NL</TAAL>\n^(.*)<EMAIL>(.*)</EMAIL>
<INTERN_NUMMER>\1</INTERN_NUMMER>\n\2<ACHTERNAAM>Diwali</ACHTERNAAM>\n\3<VOORNAAM>Sunder</VOORNAAM>\n\4<GESLACHT>V</GESLACHT>\n\5<TAAL>NL</TAAL>\n\6<EMAIL>\1@hema.whatever</EMAIL>
View Liferay Remove and add UserGroup.grv
import com.liferay.portal.service.*;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.util.*;
try{
serviceContext = new com.liferay.portal.service.ServiceContext()
long companyId = PortalUtil.getDefaultCompanyId()
employee = com.liferay.portal.service.UserGroupLocalServiceUtil.getUserGroup(companyId,"EMPLOYEE");
fired = com.liferay.portal.service.UserGroupLocalServiceUtil.getUserGroup(companyId,"FIRED_EMPLOYEE");