Skip to content

Instantly share code, notes, and snippets.

Kasun Thennakoon tmkasun

Block or report user

Report or block tmkasun

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 / config.md
Last active Nov 1, 2019
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"
View APIClient.js
const authorizations = {
OAuth2Security: {
token: { access_token: AuthManager.getUser(environment.label).getPartialToken() },
},
};
View sample_api_response.json
{
"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 Aug 22, 2017
WSO2 API Manager get all subscriptions available for APIs created by given provider (user)
View apim_get_all_subscriptions_by_provider.py
import requests, base64
configs = {
'credentials': {
'username': 'admin',
'password': 'admin',
},
'host': 'localhost',
'port': '9443',
'gateway_port': '8243',
@tmkasun
tmkasun / README.md
Last active Aug 10, 2017
javascript code snippets(live templates) for intellij
View README.md

intellij javascript live templates

This is an improved version of this gist thsnks to ngryman I have added three new snippets creation of ES6 class, React Class Component and React Functional Component.

How install

  • Save below XML content to a file named custom_templates.xml.
  • Note: If you want to change the file name change the file name + group attribute in <templateSet group="custom_templates"> element as well.
  • Copy the custom_templates.xml file to ~IntelliJ IDEA{version}/config/templates
@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
@tmkasun
tmkasun / in_sequence.xml
Created May 1, 2017
WSO2 APIM Dynamically Change Endpoint URL Synapse Sequence
View in_sequence.xml
<sequence xmlns="http://ws.apache.org/ns/synapse" name="WSO2AM--Ext--In">
<log level="custom">
<property name="TRACE" value="Inside InSequence"/>
</log>
<log level="full"/>
<property name="uri.var.sub_domain1" expression="get-property('system','environment.sub_domain1')"/>
<property name="uri.var.port" expression="get-property('system','environment.port')"/>
<log level="custom">
<property name="HOST " expression="$ctx:uri.var.sub_domain1"/>
<property name="PORT " expression="$ctx:uri.var.port"/>
@tmkasun
tmkasun / lepton_data_service.py
Last active Apr 19, 2017
Capture frames from Lepton camera using PyLepton and serialize the data and transmit it over web socket protocol
View lepton_data_service.py
class ThermalDataHandler(WebSocketHandler):
clients = []
DEBUG = False
def __init__(self, application, request, **kwargs):
super(ThermalDataHandler, self).__init__(application, request, **kwargs)
if not ThermalDataHandler.DEBUG:
self.lepton = Lepton("/dev/spidev0.0")
self.lepton.__enter__()
self.mock_samples = MockData()
View sample_car_artifact.xml
<artifactType type="application/vnd.knnect-car+xml" shortName="car" singularLabel="Car" pluralLabel="Cars"
hasNamespace="false" iconSet="27">
<storagePath>/trunk/car/@{overview_name}</storagePath>
<nameAttribute>overview_name</nameAttribute>
<ui>
<list>
<column name="name">
<data type="text" value="overview_name"/>
</column>
You can’t perform that action at this time.