Skip to content

Instantly share code, notes, and snippets.

View generate-cert.sh
#!/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}"
View apigee-hybrid-prerequisites.sh
#!/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"
View wso2apim-load-balancer-service.yaml
apiVersion: v1
kind: Service
metadata:
name: wso2apim-load-balancer
labels:
app: wso2apim
pattern: wso2apim-pattern-1
spec:
ports:
-
View debian-docker-install.sh
#!/bin/bash
sudo su
apt update
apt-get install \
apt-transport-https \
ca-certificates \
curl \
View wso2apim-api-handlers.xml
<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"/>
View prepare-docker-builder.sh
#!/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
View install-tomcat.sh
#!/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 Aug 20, 2017
Bash HTTP Server
View http-server.sh
#!/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
View echo-server.js
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();
@imesh
imesh / .vimrc
Created May 31, 2017
VIM configuration file for enabling NERDTree
View .vimrc
:syntax on
execute pathogen#infect()
filetype plugin indent on
set number
set tabstop=4
set colorcolumn=110
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1