Skip to content

Instantly share code, notes, and snippets.

View cgorshing's full-sized avatar
👋
Hey!

Chad Gorshing cgorshing

👋
Hey!
View GitHub Profile
@cgorshing
cgorshing / affirmation
Created March 25, 2016 19:44
MuleSoft Contributor Agreement Acceptance by Chad Gorshing
I, Chad Gorshing, have read and do accept the MuleSoft Contributor Agreement
at http://www.mulesoft.org/legal/contributor-agreement.html
Accepted on Fri Mar 25 2016 14:44:22 GMT-0500 (CDT)
@cgorshing
cgorshing / cxf.xml
Created July 24, 2014 19:32
Example showing how to override CXF for which certificates to trust.
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns="http://www.springframework.org/schema/beans"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
xmlns:sec="http://cxf.apache.org/configuration/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
HttpsURLConnection.setDefaultSSLSocketFactory(MockHttpsServer.getClientSslContext().getSocketFactory());
//SSLContext.setDefault(sc);
server = new MockSalesforceApiServer(8090);
System.setProperty("javax.net.debug", "ssl");
@BeforeClass
public static void beforeClass() {
In IdempotentRedeliveryPolicy
private String getIdForEvent(MuleEvent event) throws Exception
{
if (useSecureHash)
{
Object payload = event.getMessage().getPayload();
byte[] bytes = (byte[]) objectToByteArray.transform(payload);
if (payload instanceof InputStream)
{
@cgorshing
cgorshing / choice-exception-strategy.xml
Created February 24, 2014 22:01
Small Mule example showing a choice-exception-strategy (copied from the Mule docs)
<flow name="RouteByExceptionType">
<jms:inbound-endpoint queue="in">
<jms:transaction action="ALWAYS_BEGIN" />
</jms:inbound-endpoint>
<test:component/>
<jms:outbound-endpoint queue="out">
<jms:transaction action="ALWAYS_JOIN" />
</jms:outbound-endpoint>
<choice-exception-strategy>
<catch-exception-strategy when="exception.causedBy(com.company.BusinessException)">
#Functions are first
#Go to the end for the 'main' of the script
$ErrorActionPreference = "Stop"
Set-PSDebug -strict
Set-StrictMode –Version latest
$source = "Mule Monitoring"
#New-EventLog -LogName Application -Source $source
#EntryType - Valid values are Error, Warning, Information, SuccessAudit, and FailureAudit. The default value is Information.
package com.example;
import org.mule.api.MuleEventContext;
import org.mule.api.lifecycle.Callable;
/**
* From the docs
* "To enable the component to work directly with the message,
* you must implement the Callable interface"
*
@cgorshing
cgorshing / grep.sh
Created January 22, 2014 21:46
Find a pattern with grep but only print out 5 lines above the matching line.
grep -B5 "pattern" filename | awk -F '\n' 'ln ~ /^$/ { ln = "matched"; print $1 } $1 ~ /^--$/ { ln = "" }'
@cgorshing
cgorshing / mule-examples.txt
Last active April 25, 2017 07:17
Mule Examples
<expression-component>
payload.Address1 = app.registry.encryption.decrypt(payload.Address1)
</expression-component>
<scripting:component>
<scripting:script engine="groovy" file="scripts/create-player-request-transformer.groovy"/>
</scripting:component>
<expression-component>
Runtime.getRuntime().exec("C:\\myfile.exe arg1 " + message.correlationId);
@cgorshing
cgorshing / gist:3978124
Last active September 1, 2020 03:10
From /var/lib/dpkg/info/gmetad.postinst
#!/bin/sh
set -e
if ! getent group ganglia >/dev/null; then
echo Adding group: ganglia.
groupadd --system ganglia
fi
if ! getent passwd ganglia >/dev/null; then
echo Adding system user: ganglia.