Skip to content

Instantly share code, notes, and snippets.

@nabsha
nabsha / reencrypt.sh
Created May 6, 2022 00:51
A quick hack to re encrypting mule secure properties file
#!/bin/bash
if [ "$#" -ne 4 ]; then
echo "usage: ./reencrypt.sh <Algo> <Key Source> <source file> <Key Target>";
exit -1;
fi
ALGO=$1
KEY_SOURCE=$2
FILE=$3
KEY_TARGET=$4
@nabsha
nabsha / generate_jsonpath_from_yaml.sh
Created November 10, 2021 01:36
Generate jsonpath out of yaml document
## This script generates properties files to generate json
## depends on yq https://kislyuk.github.io/yq/
## E.g input:
# ep1:
# connection:
# responseTimeout: "30"
## Output:
## "secure::ep1.connection.responseTimeout":"30",
cat <yamlfile>| yq -c 'paths(scalars) as $p | "secure::\($p|join(".")):\(getpath($p))",'
@nabsha
nabsha / get_all_aws_ips_per_region_and_service.sh
Last active September 20, 2021 02:19
Get all AWS EC2 IP Ranges for a region and a service
#!/bin/sh
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.region=="ap-southeast-2") | select(.service=="EC2") | .ip_prefix'
@nabsha
nabsha / get_all_bitbucket_repo_links.py
Last active September 12, 2021 07:31
Get links to all repositories in a workspace using Atlassian Bitbucket Python API
#!/bin/sh
alias anypoint-cli='docker run --rm --name anypoint-cli -it integrational/anypoint-cli:3.0.0'
for env in TST SIT UAT PRD
do
echo "Environment is " $env
anypoint-cli --bearer $1 --organization $2 --environment $env --output text runtime-mgr cloudhub-application list
done
@nabsha
nabsha / mergecsv.py
Last active December 20, 2020 05:17
Generates a column-wise csv by merging all columns in all csv in given folder
import os
import pandas as pd
import glob
def merge_csvs(results_, column_prefix):
path = results_ # use your path
all_files = glob.glob(path + "/*.csv")
print(all_files)
li = []
@nabsha
nabsha / .gitconfig
Last active August 13, 2020 02:17 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Nabeel Shaheen
email =
username =
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
@nabsha
nabsha / getAllOseSecrets.sh
Created May 26, 2020 08:05
Get all openshift Opaque secrets and base64 decode then in a single line
oc get secrets -o wide --all-namespaces=true | grep qat | grep mule | awk '{ system("oc get secrets --namespace=" $1 " " $2 " -o yaml | grep credentials | cut -d: -f2 | base64 -d") }'
@nabsha
nabsha / mule
Last active May 27, 2020 23:16
This is the updated mule wrapper script for 3.9.x standalone enterprise to run on MacOS catalina
#! /bin/sh
# Copyright (c) 1999, 2013 Tanuki Software, Ltd.
#
# Java Service Wrapper sh script. Suitable for starting and stopping
# wrapped Java applications on UNIX platforms.
# Get the fully qualified path to the script
case $0 in
/*)
1
00:02:02,880 --> 00:02:07,488
Thank god
2
00:02:09,024 --> 00:02:09,792
Thanks God
3
00:02:10,816 --> 00:02:11,840