Skip to content

Instantly share code, notes, and snippets.

View tmoreira2020's full-sized avatar

Thiago Leão Moreira tmoreira2020

View GitHub Profile
@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
import java.sql.Connection;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class MainC3P0 {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
<%
int listTypeId = ParamUtil.getInteger(request, name, BeanParamUtil.getInteger(bean, request, listTypeFieldName));
List<ListType> listTypeModels = ListTypeServiceUtil.getListTypes(listType);
for (ListType listTypeModel : listTypeModels) {
%>
<aui:option selected="<%= listTypeId == listTypeModel.getListTypeId() %>" value="<%= listTypeModel.getListTypeId() %>"><liferay-ui:message key="<%= listTypeModel.getName() %>" /></aui:option>
@tmoreira2020
tmoreira2020 / jboss-7.1.1-newrelic-3.4.2-deadlock
Created February 18, 2014 14:54
It show the deadlock when you have jboss-7.1.1 + newrelic-3.4.2
Found one Java-level deadlock:
=============================
"MSC service thread 1-16":
waiting to lock monitor 0x00007fb71c003ef8 (object 0x0000000601fb0f48, a org.jboss.modules.ModuleClassLoader),
which is held by "MSC service thread 1-1"
"MSC service thread 1-1":
waiting to lock monitor 0x00007fb71c003e50 (object 0x000000060016ce60, a com.newrelic.agent.instrumentation.weaver.Verifier),
which is held by "MSC service thread 1-11"
"MSC service thread 1-11":
waiting to lock monitor 0x00007fb71c003ef8 (object 0x0000000601fb0f48, a org.jboss.modules.ModuleClassLoader)
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.Statement;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
public class LiferayShardingMigrationTool {
@Test
public void test() {
RestTemplate restTemplate = restTemplate();
Link next = new Link("http://localhost:8080/v1/city?size=250&sort=name&name.dir=asc");
do {
System.out.println(next.getHref());
ResponseEntity<PagedResources<City>> responseEntity = restTemplate.exchange(next.getHref(), HttpMethod.GET, null,
new ParameterizedTypeReference<PagedResources<City>>() {
==> default: Running provisioner: shell...
==> default: Machine State ID: active
==> default: IP Address: 45.79.188.40
default: Running: inline script
==> default: c
==> default: u
==> default: r
==> default: l
==> default: :
==> default:
This file has been truncated, but you can view the full file.
18:33:04,921 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.6.Final-redhat-1
18:33:05,669 INFO [org.jboss.msc] (main) JBoss MSC version 1.1.5.Final-redhat-1
18:33:05,743 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: JBoss EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21) starting
18:33:05,749 DEBUG [org.jboss.as.config] (MSC service thread 1-6) Configured system properties:
[Standalone] =
awt.toolkit = sun.lwawt.macosx.LWCToolkit
file.encoding = UTF-8
file.encoding.pkg = sun.io
file.separator = /
ftp.nonProxyHosts = local|*.local|169.254/16|*.169.254/16
<#assign time1 = .now?time?long>
<#assign perf_count = 0>
<#assign service = serviceLocator.findService("com.liferay.journal.util.JournalContent") >
<#assign model = objectUtil("com.liferay.portal.kernel.portlet.PortletRequestModel", renderRequest, renderResponse)>
<#if entries?has_content>
<#list entries as curEntry>
<#assign renderer = curEntry.getAssetRenderer()>
<#assign article = renderer.getArticle()>
// ### Groovy Sample ###
list = com.liferay.portal.kernel.service.PortletPreferencesLocalServiceUtil.getPortletPreferencesByPlid(20146);
for (preferences in list) {
out.println(preferences)
}