Skip to content

Instantly share code, notes, and snippets.

View jdeoliveira's full-sized avatar

Jesus De Oliveira jdeoliveira

  • London
  • 17:05 (UTC +01:00)
View GitHub Profile
@jdeoliveira
jdeoliveira / gist:6007398
Created July 16, 2013 09:58
Reconfiguring VMWare Fusion 4 port forwarding
sudo vim /Library/Preferences/VMware\ Fusion/vmnet8/nat.conf
[incomingtcp]
1414 = 172.16.237.246:1414
1414 = 172.16.237.244:1414
sudo /Applications/VMware\ Fusion.app/Contents/Library/services.sh --stop
sudo /Applications/VMware\ Fusion.app/Contents/Library/services.sh --start
@jdeoliveira
jdeoliveira / gist:4132739
Created November 22, 2012 20:06
Multiple config files with Spring PropertyPlaceHolderConfigurer
<spring:bean id="property-placeholder" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
<spring:property name="locations">
<spring:list>
<spring:value>classpath:first.properties</spring:value>
<spring:value>classpath:second.properties</spring:value>
</spring:list>
</spring:property>
</spring:bean>
@jdeoliveira
jdeoliveira / gist:4080656
Created November 15, 2012 19:28
Dump/restore a postgres database in binary format for distribution
/Library/PostgreSQL/9.1/bin/pg_dump --host localhost --port 5432 --username <USERNAME> -b -c -E UTF-8 --no-owner --no-privileges --no-tablespaces --clean --schema public -F c -Z 9 -f <BACKUPFILENAME> <DATABASENAME>
/Library/PostgreSQL/9.1/bin/pg_restore --host localhost --port 5432 --username <USERNAME> --dbname <DATABASENAME> --no-owner --no-privileges --no-tablespaces --clean --schema public "<BACKUPFILENAME>"
@jdeoliveira
jdeoliveira / log4j.properties
Created July 13, 2012 19:50
log4j configuration for full wire logging of CXF
# Default log level
log4j.rootCategory=INFO, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p %d [%t] %c: %m%n
################################################
# You can set custom log levels per-package here
################################################
@jdeoliveira
jdeoliveira / gist:3093611
Created July 11, 2012 21:21
Mule flow to PUT form encoded data through HTTP
<flow name="httpputFlow" doc:name="httpputFlow">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8086" doc:name="HTTP"/>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy">
<scripting:text>
<![CDATA[
HashMap map = new HashMap();
map.put("param1", "value1");
map.put("param2", "value2");
@jdeoliveira
jdeoliveira / gist:3040626
Created July 3, 2012 15:52
Sending JMS messages using ActiveMQ
import javax.jms.*;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
Connection connection = connectionFactory.createConnection();
connection.start();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@jdeoliveira
jdeoliveira / gist:3040603
Created July 3, 2012 15:49
Embedded ActiveMQ reachable from outside mule
<jms:activemq-connector name="Active_MQ" specification="1.1" brokerURL="vm:broker:(tcp://localhost:61616)?broker.persistent=false" embeddedMode="true" validateConnections="true" doc:name="Active_MQ"/>
@jdeoliveira
jdeoliveira / gist:3026562
Created July 1, 2012 02:37
WCFConsumer mule application configuration
<flow name="wcfconsumerFlow1" doc:name="wcfconsumerFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="submitOrder" doc:name="HTTP"/>
<response>
<object-to-string-transformer doc:name="Object to String"/>
</response>
<http:body-to-parameter-map-transformer doc:name="Body to Parameter Map"/>
<choice doc:name="Choice">
<when expression="#[Integer.parseInt(payload['qty']) &lt; 100]">
<processor-chain>
<scripting:component doc:name="Groovy">
@jdeoliveira
jdeoliveira / gist:3026545
Created July 1, 2012 02:30
Groovy script to construct an Order object to call the WCF service
import com.mulesoft.wcfconsumer.*;
ObjectFactory of = new ObjectFactory();
Order o = of.createOrder();
o.setProductId(of.createOrderProductId(payload['productCode']));
o.setQuantity(of.createOrderQuantity(payload['qty']));
return o;
@jdeoliveira
jdeoliveira / gist:3026413
Created July 1, 2012 01:32
WCF place order HTML form
<html>
<body>
<h1>Submit order</h1>
<form action="http://localhost:8081/submitOrder" method="POST">
Product code: <input name="productCode" type="TEXT" />
Quantity: <input name="qty" type="TEXT" />
<input type="submit">
</form>
</body>
</html>