Skip to content

Instantly share code, notes, and snippets.

View IMS94's full-sized avatar
💭
git commit -m "few more changes"

Imesha Sudasingha IMS94

💭
git commit -m "few more changes"
View GitHub Profile
{
"name": "Frappe Bench",
"forwardPorts": [8000, 9000, 6787],
"remoteUser": "frappe",
// "settings": {
// "terminal.integrated.profiles.linux": {
// "frappe bash": {
// "path": "/bin/bash"
// }
// },
@IMS94
IMS94 / country_by_callingcode_api.yaml
Created October 28, 2022 05:02
OpenAPI spec for get country by calling code API
openapi: 3.0.1
info:
title: /
version: 0.1.0
servers:
- url: "{server}:{port}/"
variables:
server:
default: http://localhost
port:
package com.example.springboot.jwt;
import com.nimbusds.jose.JOSEObjectType;
import com.nimbusds.jose.proc.DefaultJOSEObjectTypeVerifier;
import org.springframework.boot.autoconfigure.security.oauth2.resource.OAuth2ResourceServerProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.security.oauth2.jwt.NimbusJwtDecoder;
{
"access_token": "eyJ4NXQiOiJaakV5WlRVMFptRXhaVEJsWkdVMVkyUTFZalJpTjJZeE9XWmlNR00zWkRoalkySTNZek14WlRjNE5XTmlPV1UxTmpKbE1qTXpaVGcyTTJWbFpEVTNaUSIsImtpZCI6IlpqRXlaVFUwWm1FeFpUQmxaR1UxWTJRMVlqUmlOMll4T1daaU1HTTNaRGhqWTJJM1l6TXhaVGM0TldOaU9XVTFOakpsTWpNelpUZzJNMlZsWkRVM1pRX1JTMjU2IiwidHlwIjoiYXQrand0IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI2MDRiODc5ZS0wZDZhLTQwYjItOTEyNS05MjFjM2E4MjYwZWIiLCJhdXQiOiJBUFBMSUNBVElPTl9VU0VSIiwiYmluZGluZ190eXBlIjoic3NvLXNlc3Npb24iLCJpc3MiOiJodHRwczpcL1wvYXBpLmFzZ2FyZGVvLmlvXC90XC9pbWVzaGFvcmdcL29hdXRoMlwvdG9rZW4iLCJjbGllbnRfaWQiOiJ0d0dDcEhpMFl5cVlyZU5CYmFRR1FHZlVLX0VhIiwiYXVkIjoidHdHQ3BIaTBZeXFZcmVOQmJhUUdRR2ZVS19FYSIsIm5iZiI6MTY1Njg2MjI4MSwiYXpwIjoidHdHQ3BIaTBZeXFZcmVOQmJhUUdRR2ZVS19FYSIsInNjb3BlIjoiZW1haWwgb3BlbmlkIHByb2ZpbGUiLCJleHAiOjE2NTY4NjU4ODEsImlhdCI6MTY1Njg2MjI4MSwiYmluZGluZ19yZWYiOiI1ZmUxNDVhODg3Mzk1NDljNmEyNWM0ZDgxNjg0NGU4NyIsImp0aSI6IjA5M2IxNTFmLTI5NzEtNDkyYS1iZWFjLTEzOTFmMDJjZjg4ZiIsInVzZXJuYW1lIjoiaW1lc2hhQHdzbzIuY29tIn0.cuTj9KwppvR3JzM19eiils3NlFRod7HhNgJZnjh92h3y_1q2p8
package com.example.springboot.jwt;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
/**
package com.example.springboot.jwt.controller;
import com.example.springboot.jwt.entity.Product;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
package com.example.springboot.jwt.entity;
import java.util.UUID;
/**
* Represents a product
*/
public class Product {
private String id;
@IMS94
IMS94 / stackoverflow_to_gchat.bal
Created April 21, 2022 06:29
A Ballerina program to get latest Ballerina tagged stackoverflow questions as notifications to the google chat
import ballerina/http;
import ballerina/time;
import ballerina/log;
configurable string chatId = ?;
configurable string chatKey = ?;
configurable string chatToken = ?;
// How often will this program be executed
configurable int intervalSeconds = 60 * 10;
@IMS94
IMS94 / crud_service.bal
Last active January 26, 2022 09:30
An in memory CRUD service written in Ballerina
import ballerina/http;
import ballerina/log;
import ballerina/uuid;
# Represents a product
#
# + id - Product ID
# + name - Name of the product
# + description - Product description
# + price - Product price
@IMS94
IMS94 / currency_converter.bal
Created January 6, 2022 08:19
A simple currency conversion API written in Ballerina
import ballerina/log;
import ballerina/http;
configurable int port = 8080;
http:Client dccClient = check new("https://api.exchangerate.host");
type ConversionResponse record {
boolean success;
string base;