Skip to content

Instantly share code, notes, and snippets.

View ldclakmal's full-sized avatar
🎯
Focusing

Chanaka Lakmal ldclakmal

🎯
Focusing
View GitHub Profile
@ldclakmal
ldclakmal / .gitignore
Last active May 4, 2023 13:21
A powerful git-ignore file all programming languages and IDEs
# Build tool files
.gradle/
.mvn/
/out
/build
node_modules/
# Compiled class file
*.class
@ldclakmal
ldclakmal / http2-server-push--server-1.1.0.bal
Last active January 27, 2023 03:23
Ballerina service for HTTP/2 server push
import ballerina/http;
listener http:Listener helloWorldEP = new(9095, config = { httpVersion: "2.0" });
service hello on helloWorldEP {
resource function sayHello(http:Caller caller, http:Request req) {
// Send a Push Promises for 2 resources with 2 methods.
http:PushPromise promise1 = new(path = "/resource1", method = "GET");
@ldclakmal
ldclakmal / Stemmer.java
Created January 21, 2018 02:47
Stemmer, implementing the Porter Stemming Algorithm
package DM;
/*
Porter stemmer in Java. The original paper is in
Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14,
no. 3, pp 130-137,
See also http://www.tartarus.org/~martin/PorterStemmer
@ldclakmal
ldclakmal / Queue.cpp
Created January 24, 2015 16:02
Queue using Linked List
// LinkedList_OOP_Queue.cpp : Defines the entry point for the console application.
// L.D.C.Lakmal
#include "stdafx.h"
#include <iostream>
using namespace std;
typedef int E;
class Node {
@ldclakmal
ldclakmal / Stack.cpp
Created January 24, 2015 16:01
Stack using Linked List
// LinkedList_OOP_Stack.cpp : Defines the entry point for the console application.
// L.D.C.Lakmal
#include "stdafx.h"
#include <iostream>
using namespace std;
typedef int E;
class Node {
import ballerina/grpc;
import ballerina/jwt;
listener grpc:Listener paymentsEP = new(9191,
secureSocket = {
key: {
certFile: "/path/to/public.crt",
keyFile: "/path/to/private.key"
}
}
import ballerina/grpc;
GrpcClient clientEP = check new("https://localhost:9191",
auth = {
issuer: "order-service",
audience: ["payment-service", "delivery-service"],
keyId: "5a0b754-895f-4279-8843-b745e11a57e9",
jwtId: "JlbmMiOiJBMTI4Q0JDLUhTMjU2In",
customClaims: { "scp": "admin" },
expTime: 3600,
import ballerina/http;
import ballerina/graphql;
listener http:Listener apiGateway = new(9090,
secureSocket = {
key: {
certFile: "/path/to/public.crt",
keyFile: "/path/to/private.key"
}
}
import ballerina/http;
http:Client clientEP = check new("https://localhost:9092",
secureSocket = {
cert: "/path/to/client-public.crt",
key: {
certFile: "/path/to/server-public.crt",
keyFile: "/path/to/server-private.key"
}
}
import ballerina/http;
listener http:Listener listenerEP = new(9091,
secureSocket = {
key: {
certFile: "/path/to/server-public.crt",
keyFile: "/path/to/server-private.key"
},
mutualSsl: {
verifyClient: http:REQUIRE,