Skip to content

Instantly share code, notes, and snippets.

View tmoreira2020's full-sized avatar

Thiago Leão Moreira tmoreira2020

View GitHub Profile
@datyger
datyger / lr62-delete-WC-Versions-wDQ.groovy
Last active June 10, 2022 19:58
Script to delete all old versions of web content besides the latest version.
import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery
import com.liferay.portal.kernel.exception.PortalException
import com.liferay.portal.kernel.exception.SystemException
import com.liferay.portal.util.PropsValues
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil
import com.liferay.portal.kernel.dao.orm.DynamicQuery
import com.liferay.portal.kernel.dao.orm.Conjunction
import com.liferay.portlet.journal.service.persistence.JournalArticleResourceActionableDynamicQuery
import com.liferay.portlet.journal.service.JournalArticleServiceUtil
@sachin-handiekar
sachin-handiekar / QuartzRoute.java
Created November 5, 2014 13:27
A simple scheduler using camel-quartz
package com.sachinhandiekar.examples;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
/**
* @author Sachin Handiekar
*/
public class QuartzRoute extends RouteBuilder {
@cha55son
cha55son / dynmotd
Last active June 9, 2023 21:06
RHEL (Centos/Fedora) dynamic motd
#!/bin/bash
# Installation:
#
# 1. vim /etc/ssh/sshd_config
# PrintMotd no
#
# 2. vim /etc/pam.d/login
# # session optional pam_motd.so
#
@nshaw
nshaw / display_cluster_details.groovy
Last active August 26, 2022 07:47
v3. Sorted nodes visible to ClusterExecutor, added default heartbeat value to support LR 6.0 v2. Added more logging to improve readability, removed some logic which was examining packet content, changed duration to be based on configured heartbeat interval v1. First revision
import com.liferay.portal.kernel.cluster.ClusterExecutorUtil
import com.liferay.portal.kernel.cluster.ClusterNode
import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayInputStream
import com.liferay.portal.kernel.io.unsync.UnsyncByteArrayOutputStream
import com.liferay.portal.kernel.util.DateUtil
import com.liferay.portal.kernel.util.GetterUtil
import com.liferay.portal.kernel.util.PropsUtil
import com.liferay.portal.kernel.util.StringBundler
import com.liferay.util.transport.DatagramHandler
import com.liferay.util.transport.MulticastDatagramHandler
@tmoreira2020
tmoreira2020 / gist:2967517
Created June 21, 2012 18:16
Fix a binary conflict on git
#at the branch you want to rebase into "master > mybranch"
git rebase -s recursive -X theirs master
#then a binary conflict will happen so now you must checkout the version of the binary you want
git co --theirs -- my-binary-file.bin
git co --ours -- my-binary-file.bin
#now you must stage the file
git add my-binary-file.bin