Skip to content

Instantly share code, notes, and snippets.

View kasvith's full-sized avatar
🏠
Working from home

Kasun Vithanage kasvith

🏠
Working from home
View GitHub Profile
@Override
public void stop() throws Exception {
super.stop();
scheduledExecutorService.shutdownNow();
}
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.stage.Stage;
import java.text.SimpleDateFormat;
@kasvith
kasvith / eventbus.go
Created March 11, 2019 08:19
A simple eventbus written with go
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
type Data struct {
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
type DataEvent struct {
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
type DataEvent struct {
@kasvith
kasvith / api.yaml
Created July 16, 2019 15:26
API Parameters description
id: # ID of API
providerName: admin # Provider name for API [required]
apiName: SwaggerPetstore # Name of the API without Spaces(see publisher UI for more) [required]
version: 1.0.0 # Version of API(required)
description: 'This is a sample server Petstore server.' # Description of API
type: HTTP # Type of API {HTTP|WS} [required]
context: /v2 # Context of API with a leading slash, CLI tool will append version on import(if you want to put version like /1.0.0/v2 just set context to /{version}/v2 please refer UI for this) [required]
tags: # tags for API as a list
- pets
- petstore
@kasvith
kasvith / api_params.yaml
Created July 17, 2019 06:01
Reference for api_params.yaml
environments: # Define environments as a list
- name: dev # Name of the environment
gatewayEnvironments: # define gateway environments
- "Production and Sandbox" # List gateways
- "Another Gateway"
certs: # define certificates for endpoints as a list
- hostName: 'https://dev.wso2.com' # hostname for the certificate
alias: 'Dev Certificate' # Alias for the certificate
path: '~/certs/dev.pem' # path to public certificate file
endpoints: # Define endpoints for environment
// define default values, other resources in default package
package defaults
var ConfigTemplate = []byte(`
// content goes here
`)
// In some another package
func somefunc(){
ioutil.WriteFile("/path/to/dest", defaults.ConfigTemplate, os.ModePerm)
}
@kasvith
kasvith / defaults.go
Last active July 26, 2019 14:27
defaults.go
//go:generate go run gen.go
package box
type resourceBox struct {
storage map[string][]byte
}
func newResourceBox() *resourceBox {
return &resourceBox{storage: make(map[string][]byte)}
resources := make(map[string][]byte)
err := filepath.Walk("resources", func(path string, info os.FileInfo, err error) error {
if err != nil {
log.Println("Error :", err)
return err
}
relativePath := filepath.ToSlash(strings.TrimPrefix(path, "resources"))
if info.IsDir() {
log.Println(path, "is a directory, skipping...")
return nil