Skip to content

Instantly share code, notes, and snippets.

View tmkasun's full-sized avatar
🕶️

Kasun Thennakoon tmkasun

🕶️
View GitHub Profile
@tmkasun
tmkasun / Logout.jsx
Created September 4, 2020 15:13
Sample custom redirect
import React, { Component } from 'react';
import User from '../data/User';
import Utils from '../data/Utils';
/**
* Logout component
* @class Logout
* @extends {Component} Logout component
*/
class Logout extends Component {
@tmkasun
tmkasun / userThemes.js
Created November 27, 2020 15:20
WSO2 API Manager 3.2.0+ sample publisher theme
/**
* IMPORTANT: This file only contains theme JSS of the Publisher app, Don't add other configuration parameters here.
* This theme file is an extension of material-ui default theme https://material-ui.com/customization/default-theme/
* Application related configurations are located in `<PUBLISHER_ROOT>site/public/theme/settings.js`
*/
const userThemes = {
light(theme) {
return (
{
overrides: {
@tmkasun
tmkasun / Gauge.jsx
Created February 18, 2021 17:43
How to use canvas-gauges with React using Reeact hooks
import { LinearGauge, RadialGauge } from 'canvas-gauges'
import React, { useEffect, useRef } from 'react'
export default (props) => {
const { value, isRadial = false } = props;
const gaugeDOM = useRef();
const gauge = useRef();
useEffect(() => {
const options = Object.assign({}, props, {
renderTo: gaugeDOM.current
@tmkasun
tmkasun / launch.json
Last active March 30, 2021 02:40
vscode launch file
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "DebugWebpack",
{
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"python.languageServer": "Pylance",
"[xml]": {
"editor.defaultFormatter": "DotJoshJohnson.xml"
},
"npm.packageManager": "npm",
"editor.rulers": [
120
@tmkasun
tmkasun / demo.md
Created May 5, 2021 06:19
Demo - Effect of blocking the main event loop in JavaScript
  • Open the Link
  • Open the Developer console
  • And type
setInterval(() => {var a = Date.now(); while(Date.now() - a < 1000);},3000)
  • Open the performace monitor in the browser
  • And you will see the below CPU usage pattern image
@tmkasun
tmkasun / how-to-setup-verified-commits.md
Created September 1, 2021 15:15 — forked from Beneboe/how-to-setup-verified-commits.md
How to Setup Verified Commits on Github
@tmkasun
tmkasun / config.md
Last active May 1, 2023 10:32
How to configure nginx as a revers proxy for WSO2 API Manager SPA apps

For APIM 3.0.0

Update deployment.toml

[transport.https.properties]
proxyPort = 443

[server]
hostname = "knnect.lk"
@tmkasun
tmkasun / autoipset
Last active June 15, 2023 00:35
OpenWRT Create IPset on router startup
#!/bin/sh /etc/rc.common
# OpenWrt /etc/init.d/ script to automatically add ipsets across reboots
# For more info about how to write init scripts https://openwrt.org/docs/techref/initscripts
#
# howto:
# - upload this file as /etc/init.d/autoipset
# - # chmod 755 /etc/init.d/autoipset
# - # /etc/init.d/autoipset enable
# - # /etc/init.d/autoipset start
@tmkasun
tmkasun / rrdbackup
Created January 8, 2021 02:57
OpenWrt /etc/init.d/ script to backup and restore the rrd (collectd) database, to preserve data across reboots
#!/bin/sh /etc/rc.common
# OpenWrt /etc/init.d/ script to backup and restore the rrd (collectd) database, to preserve data across reboots
#
#
# howto:
# - upload this file as /etc/init.d/rrdbackup
# - (optional) adjust BACKUP_DIR below to point to a different target directory for the backup (e.g., a USB drive)
# - # chmod +x /etc/init.d/rrdbackup
# - # /etc/init.d/rrdbackup enable