Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
client_domain="$1"
mkdir -p ${client_domain}
pushd ${client_domain}
echo "Generating CA key and cert..."
openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -key rootCA.key -days 3650 -out rootCA.pem \
-subj "/C=AA/ST=AA/L=AA/O=AA Ltd/OU=AA/CN=ca.${client_domain}/emailAddress=abc@ca.${client_domain}"
#!/bin/bash
client_domain="$1"
mkdir -p ${client_domain}
pushd ${client_domain}
echo "Generating CA key and cert..."
openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -key rootCA.key -days 3650 -out rootCA.pem \
-subj "/C=AA/ST=AA/L=AA/O=AA Ltd/OU=AA/CN=ca.${client_domain}/emailAddress=abc@ca.${client_domain}"
#!/bin/bash
set -e
export KPT_VERSION='v0.33.0'
export APIGEE_CTL_VERSION='1.3.2'
OS_NAME=$(uname -s)
if [[ "$OS_NAME" == "Linux" ]]; then
echo "🐧 Using Linux binaries"
apiVersion: v1
kind: Service
metadata:
name: wso2apim-load-balancer
labels:
app: wso2apim
pattern: wso2apim-pattern-1
spec:
ports:
-
#!/bin/bash
sudo su
apt update
apt-get install \
apt-transport-https \
ca-certificates \
curl \
<handlers>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.common.APIMgtLatencyStatsHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler">
<property name="apiImplementationType" value="ENDPOINT"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtUsageHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtGoogleAnalyticsTrackingHandler">
<property name="configKey" value="gov:/apimgt/statistics/ga-config.xml"/>
#!/bin/bash
set -e
sudo su
echo "Installing prerequisites..."
apt install -y docker.io git bc
echo "Downloading WUM..."
wget https://product-dist.wso2.com/downloads/wum/1.0.0/wum-1.0-linux-x64.tar.gz
#!/bin/bash
sudo apt-get update
sudo apt-get install default-jdk
sudo groupadd tomcat
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
wget http://www-eu.apache.org/dist/tomcat/tomcat-8/v8.5.20/bin/apache-tomcat-8.5.20.tar.gz
sudo tar -xzvf apache-tomcat-8.5.20.tar.gz
mv apache-tomcat-8.5.20 /opt/tomcat
@imesh
imesh / http-server.sh
Created August 20, 2017 10:24
Bash HTTP Server
#!/usr/bin/env bash
ip=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
response="HTTP/1.1 200 OK\r\nConnection: keep-alive\r\n\r\n${2:-"OK ${ip}"}\r\n"
while { echo -en "${response}"; } | nc -l "${1:-8080}"; do
echo ""
done
const express = require('express')
const os = require('os');
const app = express()
app.get('/', function (req, res) {
res.send('Response from ' + getIPAddress())
})
function getIPAddress() {
var interfaces = require('os').networkInterfaces();