Skip to content

Instantly share code, notes, and snippets.

View schadokar's full-sized avatar
😵

Shubham Chadokar schadokar

😵
View GitHub Profile
@schadokar
schadokar / pee.js
Created August 5, 2019 11:20
track your effective hours
const pee = (effHrs, effMins, lastInHrs, lastInMins, avgHrs, avgMins) => {
let totalEffMins = effHrs * 60 + effMins;
let avg = avgHrs * 60 + avgMins;
let diffInMins;
let leaveHrs;
let leaveMins;
const currentTime = new Date().toLocaleTimeString({
timeZone: "Asia/Kolkata"
});
@schadokar
schadokar / mergesort.js
Created January 9, 2020 13:13
Merge Sort Algorithm in javascript
/**
* ************************************************ MERGE SORT *****************************************************
*
* [38, 27, 43, 3, 9, 82, 10, 900, 78, 80, 11]
* / \
* [38, 27, 43, 3, 9, 82] [10, 900, 78, 80, 11]
* / \ / \
* [38, 27, 43] [3, 9, 82] [10, 900, 78] [ 80, 11 ]
* / \ / \ / \ / \
* [38, 27] [ 43 ] [3, 9] [ 82 ] [10, 900] [ 78 ] [ 80 ] [ 11 ]
@schadokar
schadokar / quicksort.js
Last active March 3, 2020 05:31
Quicksort implementation in js
/**
* ********************************** Quick Sort ***********************************************
* UNSORTED ARRAY [3, 7, 8, 5, 2, 1, 9, 6, 4]
* pivot ^
* pivot: 3 arr: [ 2, 1, 3, 5, 8, 7, 9, 6, 4 ]
* [2, 1] [5, 8, 7, 9, 6, 4 ]
* pivot ^ ^
* pivot: 2 arr: [ 1, 2 ]
* pivot: 5 arr: [ 4, 5, 7, 9, 6, 8 ]
* [ 4] [7, 9, 6, 8 ] --> Array with single element is sorted
@schadokar
schadokar / client.js
Last active February 8, 2020 11:53
Fabric Sample balance transfer client for the couchdb wallet
'use strict';
var log4js = require('log4js');
var logger = log4js.getLogger('Helper');
logger.setLevel('DEBUG');
var path = require('path');
var util = require('util');
var hfc = require('fabric-client');
hfc.setLogger(logger);
@schadokar
schadokar / quicksort.go
Created March 3, 2020 05:32
Quicksort Implementation in golang
/**
* ********************************** Quick Sort ***********************************************
* UNSORTED ARRAY [3, 7, 8, 5, 2, 1, 9, 6, 4]
* pivot ^
* pivot: 3 arr: [ 2, 1, 3, 5, 8, 7, 9, 6, 4 ]
* [2, 1] [5, 8, 7, 9, 6, 4 ]
* pivot ^ ^
* pivot: 2 arr: [ 1, 2 ]
* pivot: 5 arr: [ 4, 5, 7, 9, 6, 8 ]
* [ 4] [7, 9, 6, 8 ] --> Array with single element is sorted
@schadokar
schadokar / 0-self-publishing.md
Created May 2, 2020 17:33 — forked from caseywatts/0-self-publishing.md
Self-Publishing via Markdown

short url: caseywatts.com/selfpublish


Markdown --> PDF (as a booklet!)

Markdown --> EPUB and MOBI

I'm working on a book, "Debugging Your Brain" which I plan to self-publish. I'm writing the chapters in Markdown, and I want to have it both printed on paperback and available as an eBook on Kindle etc. Here are the tools I used to get my markdown files (from my Jekyll based blog) into the PDF, EPUB, and MOBI formats.

@schadokar
schadokar / node-mail.js
Last active July 19, 2020 15:02
Basic send mail using nodejs
"use strict";
const nodemailer = require("nodemailer");
/**
* sendEmail
* @param {Object} mailObj - Email meta data and body
* @param {String} from - Email address of the sender
* @param {Array} recipients - Array of recipients email address
* @param {String} subject - Subject of the email
* @param {String} message - message
#!/usr/bin/env bash
#
# Run a minimal Solana cluster. Ctrl-C to exit.
#
# Before running this script ensure standard Solana programs are available
# in the PATH, or that `cargo build` ran successfully
#
set -e
# Prefer possible `cargo build` binaries over PATH binaries
@schadokar
schadokar / spiral-matrix.js
Created November 13, 2020 12:16
Create a spiral matrix
// --- Directions
// Write a function that accepts an integer N
// and returns a NxN spiral matrix.
// --- Examples
// matrix(2)
// [[1, 2],
// [4, 3]]
// matrix(3)
// [[1, 2, 3],
// [8, 9, 4],
@schadokar
schadokar / client.go
Last active October 5, 2022 15:10
redisrepo
package redisrepo
import (
"context"
"log"
"os"
"github.com/go-redis/redis/v8"
)