Skip to content

Instantly share code, notes, and snippets.

View tmkasun's full-sized avatar
🕶️

Kasun Thennakoon tmkasun

🕶️
View GitHub Profile
@tmkasun
tmkasun / Logout.jsx
Created September 4, 2020 15:13
Sample custom redirect
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 / defaultTheme.js
Created April 13, 2020 15:50
Sample config to enable language switcher
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 February 15, 2020 16:07
Setting up wakeonlan useful commands

Check wake on lan supported and enabled in hardware

sudo ethtool <NIC>

wakeonland command installation

in mac use

@tmkasun
tmkasun / md.js
Last active February 13, 2020 16:54
{
.
.
.
externals: {
Themes: 'AppThemes', // Should use long names for preventing global scope JS variable conflicts
MaterialIcons: 'MaterialIcons',
Config: 'AppConfig',
}
}
@tmkasun
tmkasun / thread_analyser.sh
Created November 28, 2019 08:23
Thread analyser for MAC
#!/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 November 7, 2019 10:46
WSO2 API Manager 3.0 Publisher app read only mode

image

{
  "EnableMonetization" : false,
  "IsUnlimitedTierPaid" : false,
  "ExtensionHandlerPosition": "bottom",
  "RESTAPIScopes": {
    "Scope": [
      {
@tmkasun
tmkasun / dev_mode.sh
Last active October 17, 2019 09:02
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 ...
#! /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
@tmkasun
tmkasun / APIClient.js
Last active February 6, 2019 04:31
APIClient
const authorizations = {
OAuth2Security: {
token: { access_token: AuthManager.getUser(environment.label).getPartialToken() },
},
};
{
"id": "01234567-0123-0123-0123-012345678901",
"name": "CalculatorAPI",
"description": "A calculator API that supports basic operations",
"context": "CalculatorAPI",
"version": "1.0.0",
"provider": "admin",
"lifeCycleStatus": "CREATED",
"workflowStatus": "APPROVED",
"securityScheme": [
@tmkasun
tmkasun / apim_get_all_subscriptions_by_provider.py
Last active August 22, 2017 18:17
WSO2 API Manager get all subscriptions available for APIs created by given provider (user)
import requests, base64
configs = {
'credentials': {
'username': 'admin',
'password': 'admin',
},
'host': 'localhost',
'port': '9443',
'gateway_port': '8243',