Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Kasun Thennakoon tmkasun

🏠
Working from home
View GitHub Profile
@tmkasun
tmkasun / Logout.jsx
Created Sep 4, 2020
Sample custom redirect
View Logout.jsx
import React, { Component } from 'react';
import User from '../data/User';
import Utils from '../data/Utils';
/**
* Logout component
* @class Logout
* @extends {Component} Logout component
*/
class Logout extends Component {
@tmkasun
tmkasun / nginx CORS configuration.md
Last active Aug 1, 2020
How to configure Nginx to add CORS
View nginx CORS configuration.md

This document explain how to

  • Generate SSL self sign certificate with subject alternative names using openssl tool
  • Configure nginx to add CORS OPTION call handler for none-cors endpoints

This gist is mostly for my future references 😄

  • First you need to have openssl configuration file to tell the tool what kind of certificate do you need, Following is a sample certificate file containing two SAN domains
@tmkasun
tmkasun / config.md
Last active May 25, 2020
How to configure nginx as a revers proxy for WSO2 API Manager SPA apps
View config.md

For APIM 3.0.0

Update deployment.toml

[transport.https.properties]
proxyPort = 443

[server]
hostname = "knnect.lk"
@tmkasun
tmkasun / defaultTheme.js
Created Apr 13, 2020
Sample config to enable language switcher
View defaultTheme.js
const Configurations = {
/* Refer devportal/source/src/defaultTheme.js */
custom: {
languageSwitch: {
active: true,
languages: [
{
key: 'en',
image: '/site/public/images/flags/en.png',
imageWidth: 24, // in pixles
@tmkasun
tmkasun / Ubuntu wake on LAN.md
Created Feb 15, 2020
Setting up wakeonlan useful commands
View Ubuntu wake on LAN.md

Check wake on lan supported and enabled in hardware

sudo ethtool <NIC>

wakeonland command installation

in mac use

View md.js
{
.
.
.
externals: {
Themes: 'AppThemes', // Should use long names for preventing global scope JS variable conflicts
MaterialIcons: 'MaterialIcons',
Config: 'AppConfig',
}
}
@tmkasun
tmkasun / thread_analyser.sh
Created Nov 28, 2019
Thread analyser for MAC
View thread_analyser.sh
#!/bin/bash
if [ "$#" -ne 3 ]; then
echo "usage: sh thread-analyze.sh <pid> <number-of-dumps> <interval>"
exit
fi
count=$2
for i in `seq 1 $count`;
do
mkdir -p report
@tmkasun
tmkasun / readme.md
Created Nov 7, 2019
WSO2 API Manager 3.0 Publisher app read only mode
View readme.md

image

{
  "EnableMonetization" : false,
  "IsUnlimitedTierPaid" : false,
  "ExtensionHandlerPosition": "bottom",
  "RESTAPIScopes": {
    "Scope": [
      {
@tmkasun
tmkasun / dev_mode.sh
Last active Oct 17, 2019
Setup APIM server and Run it with it's depending servers, Will only be useful until API manager product properly pack the dependencies in to final product. Till we get there ...
View dev_mode.sh
#! /usr/bin/env bash
# HOW TO USE: Put this file inside the directory where you would like to extract and run the product-APIM build file (.zip file)
# Change the below path variables accordingly *** NOTE: No trailing `/` slashes has been used
# This will only work with APIM 3.0.0 latest version with Carbon 4.x kernel. Addition to coping and unziping the pack,
# This script will only create symbolic links to the carbon-apimgt repository files.
source_path="/Users/tmkasun/Documents/wso2/dev/products/apim/carbon-apimgt-forked/features/apimgt"
product_apimgt_path="/Users/tmkasun/Documents/wso2/dev/products/apim/product-apim-forked"
pack_name="wso2am-3.0.0-SNAPSHOT"
action=$1
View APIClient.js
const authorizations = {
OAuth2Security: {
token: { access_token: AuthManager.getUser(environment.label).getPartialToken() },
},
};
You can’t perform that action at this time.