Skip to content

Instantly share code, notes, and snippets.

@aimtiaz11
aimtiaz11 / curl.sh
Last active February 26, 2025 08:12
Curl - Echo only HTTP status
curl -Iso /dev/null -w "%{http_code}\n" -k https://www.google.com.au
@aimtiaz11
aimtiaz11 / keep_putty_alive.md
Last active September 6, 2023 11:26
Linux: Keeping Putty Session Alive

Linux: Keeping Putty Session Alive

Set to alias or copy paste to terminal to keep session alive.

while true; do echo "hello" > /dev/null; sleep 25; done
@aimtiaz11
aimtiaz11 / timer-vars.md
Last active October 27, 2025 05:17
Adding Timer Variables in Mule Flows

Adding Timer Variables in Mule Flows

Adding timer variables in Mule flows to check for performance bottlenecks.

Setting Timer Variable set-variable

<set-variable value="#[%dw 2.0 import currentMilliseconds from dw::util::Timer --- currentMilliseconds()]" 
              variableName="http_before" doc:name="http_before" mimeType="application/java"/>
@aimtiaz11
aimtiaz11 / readme.md
Created October 19, 2022 06:14
Multiple Payload Validation Error using Mule 4 Dataweave
@aimtiaz11
aimtiaz11 / readme.md
Last active October 14, 2022 14:20
Making Munit work in Studio 7 (Mule 4)

Making Munit work in Studio 7 (Mule 4)

If you are having trouble running Munit in Anypoint Studio, try updating your Studio version and application's munit dependencies to latest versions.

After doing updating to below updates, I could run & debug Munit tests in my Anypoint Studio.

Prior to that, I was getting all kind of weird internal errors.

My Setup (as of 14th October 2022):

@aimtiaz11
aimtiaz11 / munit-sample.xml
Created October 12, 2022 06:37
Munit Set Event (Payload and Query Params)
<munit:execution>
<munit:set-event doc:name="Set Event - Payload and Query Params">
<munit:payload value="#[MunitTools::getResourceAsString('some-api/api-request.json')]" mediaType="application/json" />
<munit:attributes value='#[
{
"queryParams": {
"doc_type": "abcd"
},
"uriParams": {
@aimtiaz11
aimtiaz11 / readme.md
Last active September 21, 2022 02:37
Anypoint - Listing apps deployed in Environment

Anypoint - Listing apps deployed in Environment

The APIs to list appliations deployed to an environment in Mulesoft depends on the type of application - Cloudhub, On-prem, or RTF.

CloudHub

Cloudhub APIs

On-Prem

Use the Anypoint Runtime Manager or ARM APIs

@aimtiaz11
aimtiaz11 / readme.md
Created September 8, 2022 01:20
Windows - find & kill processes occupying port

Windows - Find & Kill processes occupying port

Find the process

netstat -a -n -0 | find "8081"

Note down the value in last column which is the PID.

Get Process Details

Get-Process | Where-Object {$_.Id -eq 16820}
@aimtiaz11
aimtiaz11 / bash-reference.md
Last active January 16, 2023 23:43
Bash Reference - If-statements

Bash Reference - If-statements

Arithmatic Operation

Wrap expression in the if-statement with (( expression));

STRING_COUNT=$(grep -c 'hello world' path/to/file.txt)
echo "String count: $STRING_COUNT"

if (($STRING_COUNT == 1 )); then
 sed -i 's/hello world/hello mars/' path/to/file.txt
@aimtiaz11
aimtiaz11 / get-token.ps1
Created July 26, 2022 03:22
Get OAuth Token from Anypoint via Connected App (PowerShelll)
$ClientId = "<enter connect app client id>"
$ClientSecret = "<enter connect app client secret>"
## Step 1: Login to get Token
$Props = @{
Uri = "https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token"
Method = "POST"
Headers = @{