Skip to content

Instantly share code, notes, and snippets.

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

Krishna Pravin KrishnaPravin

🏠
Working from home
View GitHub Profile
const letters = {
'A': 1,
'T': 4,
'M': 4,
'N': 5,
}
// tn = 9, 42 = 6, am = 5
// tn42am = 2
const ns0 = [1,3,5,6,9,10,14,15,16,18,21,24,27,32,33,36,42,46,50,51]
@KrishnaPravin
KrishnaPravin / SelectNelali-chittaCheckNewRural_en.js
Last active July 7, 2023 17:58
Select Nelali in TN eservices chitta download portal
//https://eservices.tn.gov.in/eservicesnew/land/chittaCheckNewRural_en.html?lan=en
// https://mrcoles.com/bookmarklet/
district = document.getElementById('districtCode');
district.value = "32";
district.dispatchEvent(new Event('change'));
setTimeout(() => {
talukCode = document.getElementById('talukCode');
talukCode.value = "05";
talukCode.dispatchEvent(new Event('change'));
@KrishnaPravin
KrishnaPravin / parseFilePathMap.js
Created August 25, 2021 06:56
convert file path in object format to array structure suitable for rendering file tree
const k = {
Age1036: {
FGB05: {
'FBG05 06hr 2020': {
'Section 1': [
'file_example_TIFF_1MB - Copy (2).tiff',
'file_example_TIFF_1MB - Copy (3).tiff',
'file_example_TIFF_1MB - Copy (4).tiff',
],
'Section 2': [
@KrishnaPravin
KrishnaPravin / Dockerfile
Last active March 23, 2021 07:56
Docker File NPM run build from environment variable
FROM node:alpine
COPY . .
ARG APP_ENV=dev
RUN npm run build:$APP_ENV
<html>
<body>
<p id="text">Waiting to start</p>
<script>
document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('click', start);
const p = document.getElementById('text');
const wait = (time = 1) => new Promise((r) => setTimeout(r, time * 1000));
speechSynthesis.getVoices();
@KrishnaPravin
KrishnaPravin / colors.js
Created February 27, 2020 03:45
Get colour escape sequence for javascript console.log
module.exports = new Proxy(
{ fgRed: "31", fgGreen: "32" }, // More colors @ https://stackoverflow.com/a/41407246/5947136
{ get: (obj, prop) => `\x1b[${obj[prop]}m%s\x1b[0m` }
);
@KrishnaPravin
KrishnaPravin / main.dart
Created February 16, 2020 19:02
Flutter Dart DateTime comparisons for chat messages read/unread
void main() {
var lM = DateTime.parse('2020-01-01T00:00:01');
var lR = DateTime.parse('2020-01-01T00:00:02');
print(lM.compareTo(lR)); // Read
lM = DateTime.parse('2020-01-01T00:00:02');
lR = DateTime.parse('2020-01-01T00:00:01');
print(lM.compareTo(lR)); // UnRead
lM = DateTime.parse('2020-01-01T00:00:01');
lR = DateTime.parse('2020-01-01T00:00:01');
print(lM.compareTo(lR)); // UnRead
@KrishnaPravin
KrishnaPravin / 2018-https-localhost.md
Created October 13, 2019 11:05 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).