Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Chanaka Lakmal ldclakmal

🎯
Focusing
Block or report user

Report or block ldclakmal

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
@ldclakmal
ldclakmal / ballerina-sample-scenario.md
Last active Aug 15, 2019
Ballerina Sample Scenario with Authentication and Authorization
View ballerina-sample-scenario.md

HTTP Services Scenario with Authn/Authz

An HTTP passthrough scenario where upstream service is secured with a Custom-Auth scheme, where it authenticates the incoming requests with the header Authorization: X-Token <base-64-encoded-username:password> against a config-user store as in Basic-Auth scheme. The upstream service have 2 resources where resource named basic call to the downstream service with an HTTP client secured with Basic-Auth and resource named jwt call to the downstream service with an HTTP client secured with JWT-Auth.

The downstream service is secured with both Basic-Auth scheme and JWT-Auth scheme. The scopes of the downstream service are write and update.

Authentication or Authorization failures of upstream and downsream services should be respectively notified to user with the message pattern of <Authentication/Authorization> failure for at <upsream/downstream> service.

NOTE: The user, who successfully authenticated with upstream service should be able to a

@ldclakmal
ldclakmal / ballerina-performance-test.md
Last active Aug 2, 2019
How to execute performance tests for Ballerina
View ballerina-performance-test.md

How to execute performance tests for Ballerina

Requirments

All 3 machines should be up and connected to the network switch. So, the following IPs should be automatically assigned to those machines.

Machine Name IP
JMeter 169.254.96.242
Ballerina 169.254.147.148
Netty 169.254.107.89
@ldclakmal
ldclakmal / .bashrc.sh
Created Jun 20, 2019
Developer Command Alias
View .bashrc.sh
alias reset-cpu='killall fwupd'
alias git-pass='git config credential.helper store'
alias mci='mvn clean install'
alias mcist='mvn clean install -DskipTests -Dmaven.test.skip=true'
alias mciss='mvn clean install -Dfindbugs.skip=true -Dspotbugs.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dpmd.skip=true -Dcobertura.skip'
alias mcisa='mciss -DskipTests -Dmaven.test.skip=true'
alias mcisax='mcisa -pl '!org.ballerinalang:examples-test''
alias gwb='gw build --info --scan'
@ldclakmal
ldclakmal / simple_http_service.bal
Last active Jun 13, 2019
Ballerina simpe HTTP service
View simple_http_service.bal
import ballerina/http;
import ballerina/log;
service hello on new http:Listener(9090) {
resource function sayHello(http:Caller caller, http:Request req) {
var result = caller->respond("Hello Ballerina!");
if (result is error) {
log:printError("Error sending response", err = result);
}
}
@ldclakmal
ldclakmal / http2_client.go
Last active Apr 20, 2019
Go HTTP/2 Client
View http2_client.go
package main
import (
"bytes"
"crypto/tls"
"crypto/x509"
"fmt"
"golang.org/x/net/http2"
"io/ioutil"
"log"
@ldclakmal
ldclakmal / http_client.go
Last active Apr 20, 2019
Go HTTP Client
View http_client.go
package main
import (
"bytes"
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"net/http"
@ldclakmal
ldclakmal / http2_server.go
Last active Mar 5, 2019
Go HTTP/2 Server
View http2_server.go
package main
import (
"fmt"
"golang.org/x/net/http2"
"io/ioutil"
"log"
"net/http"
)
View http_server.go
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
func main() {
@ldclakmal
ldclakmal / .gitignore
Last active Feb 8, 2019
A powerful git-ignore file all programming languages and IDEs
View .gitignore
# Build tool files
.gradle/
.mvn/
/out
/build
node_modules/
# Compiled class file
*.class
@ldclakmal
ldclakmal / ballerina-github-project.bal
Created Nov 5, 2018
Print GitHub projects and list of projects withing a repository
View ballerina-github-project.bal
import ballerina/config;
import ballerina/http;
import ballerina/io;
import ballerina/log;
import wso2/github4;
endpoint github4:Client githubClient {
clientConfig: {
auth: {
scheme: http:OAUTH2,
You can’t perform that action at this time.