Skip to content

Instantly share code, notes, and snippets.

View Suvink's full-sized avatar
🏢
Working from office

Suvin Nimnaka Suvink

🏢
Working from office
View GitHub Profile
@Suvink
Suvink / MetadataFilter.java
Last active April 2, 2024 05:41
Spring Authorization Sample Thread Local Context
public class MetadataFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
try {
String tenantId = request.getHeader('X-Tenant-Id');
TenantContextHolder.getContext().setTenantId(tenantId);
filterChain.doFilter(request, response);
<?xml version="1.0" encoding="utf-8"?>
<profiles version="21">
<profile kind="CodeFormatterProfile" name="wso2_code_style" version="21">
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
@Suvink
Suvink / drawing.py
Created May 28, 2020 12:07
Drawing objects with Python and OpenGL.
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
def myInit():
glClearColor(1.0, 1.0, 0.0, 1.0)
glColor3f(0.2, 0.5, 0.4)
glPointSize(10.0)
gluOrtho2D(0, 500, 0, 500)
// TODO: make `pages` optional and measure the div when unspecified, this will
// allow more normal document flow and make it easier to do both mobile and
// desktop.
import {
createContext,
useCallback,
useContext,
useEffect,
useMemo,
useRef,
@Suvink
Suvink / helloThere.png
Last active October 22, 2023 06:08
Hi There! This is me...
helloThere.png
🦠 Stats for 2022-12-06 08:46:40
🌎 Global Cases: 249461042 💀 Global Deaths: 5047622
🇱🇰 Local Cases: 671711 🇱🇰 Local Hospitalized: 0
🌎 Global Recovery: ██████████████████░░ 90%
🇱🇰 Local Recovery: ███████████████████▍ 97%
@Suvink
Suvink / data_model.json
Created November 12, 2022 06:29
The data model. Ref: Mapping the Employer and Employee: a Visualization based Approach
{
"basic_information": {
"name": "Suvin Kodituwakku",
"birthday": "21/11/1998",
"email": "hello@suvin.me",
"phone_number": "+94771655198",
"home_address": "35B, Kitulampitiya Rd, Kalegana, Galle, Sri Lanka.",
"website": "https://suvin.me",
"external_links": [
"https://github.com/Suvink",
@Suvink
Suvink / hyper.js
Created November 4, 2022 14:32
My personal Hyper configuration. (More at https://hyper.is)
"use strict";
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@Suvink
Suvink / processes.json
Created October 8, 2022 08:17
Git auto deploy script for Express JS with PM2
{
"apps": [
{
"name": "Sample App Name",
"script": "index.js",
"watch": "./",
"log_date_format": "YYYY-MM-DD HH:mm Z"
}
]
}
@Suvink
Suvink / openmp.c
Last active September 30, 2022 19:07
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include <sys/time.h>
#define MATRIX_SIZE 1024
int main()
{
int i,j,k,l,p,q,r;