Skip to content

Instantly share code, notes, and snippets.

View gsandaru's full-sized avatar

GIHAN SANDARU gsandaru

View GitHub Profile
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@gsandaru
gsandaru / implicit_animations.dart
Created May 27, 2025 20:27
Flutter Implicit Animations
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
@gsandaru
gsandaru / minio-ssl-nginx-docker-compose.yml
Last active September 13, 2024 11:46
Minio Setup with SSL / Nginx (https-portal) - Docker
services:
https-portal:
image: steveltn/https-portal:1
ports:
- 80:80
- 443:443
restart: always
networks:
- front-tier
environment:
@gsandaru
gsandaru / ArticleGist2.md
Created January 4, 2020 18:56
NodeJS Client Setup KeyCloak

Imports

    const session =  require("express-session");
    const Keycloak =  require("keycloak-connect");    
    const express =  require("express");    
    const app =  express(); 
@gsandaru
gsandaru / ArticleGist1.md
Created January 4, 2020 18:52
AndroidClientSetup

Dependancies build.gradle(Module: app)

implementation ('org.jboss.aerogear:aerogear-android-authz:2.0.0') {  
        exclude module : 'compatibility-v4'  
        transitive = true  
    }
@gsandaru
gsandaru / AndroidAndKeyCloak.md
Last active April 21, 2020 17:52
OAuth2 Guide for Node Rest APIs and Android clients using KeyCloak Identity Server

OAuth2 Guide for Node Rest APIs and Android clients using KeyCloak Identity Server

What is KeyCloak ?

Keycloak is an open source Identity and Access Management solution aimed at modern applications and services. It makes it easy to secure applications and services with little to no code. It's open source and free to use

When to use KeyCloak ?

  • When you don't know how to implement complex role based user authentication/ authorization mechanism to your app.
  • Accelerated development time? maybe you'll have great business logic to focus on.

Few steps to complete !

  1. Setup and deploy KeyCloak Server. ( In 5 Mins ?😎😎 )
  2. Setup Realms and Clients.
@gsandaru
gsandaru / NotificationSnippets.java
Last active October 22, 2019 10:28
Notification Snippets
private static final String CHANNEL_ID = "com.apps.testnotifications" ;
private void createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = getString(R.string.app_name);
String description = getString(R.string.app_name);
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
channel.setDescription(description);
@gsandaru
gsandaru / CryptoUtilsTest.java
Last active February 8, 2021 20:06
AES and Blowfish file encryption for Android
import android.os.Environment;
import org.junit.Test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
@gsandaru
gsandaru / test.java
Last active August 15, 2019 12:48
Java,Android - Get RSAPrivateKey and RSAPublicKey from String
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
try {
String privateKeyContent = sharedPreferences.getString("SAMPLE_KEY_PRI",null); // load private key here