Skip to content

Instantly share code, notes, and snippets.

View hirenchauhan2's full-sized avatar
🎯
Focusing

Hiren Chauhan hirenchauhan2

🎯
Focusing
  • Calpion
  • Bangalore, India
  • 08:24 (UTC +05:30)
  • X @__hiren
View GitHub Profile
@hirenchauhan2
hirenchauhan2 / totalTime.js
Last active September 26, 2017 07:02
Calculate total time from the given times (minutes, seconds) format
/**
* Calculate total time from the given times (minutes, seconds) format
* seperated via |
* Show total hours, total minutes, and total seconds
*/
const str = "4,13|3,3|5,27|5,4|5,57|6,20|5,2|2,36|6,21|5,47|14,58|5,59|4,3|5,54|3,57|9,31|3,48|8,1|17,0|13,15|8,30|18,30|10,14|4,28|8,38|16,50|15,1|2,30|14,8|13,5"
// remove the | and make an array
let strippedStr = str.split('|')
// console.log(strippedStr)
@hirenchauhan2
hirenchauhan2 / generate self signed ssl certs.md
Last active November 13, 2017 09:51
Steps for how to generate self signed ssl certificated for HTTPS

How to create a self-signed SSL Certificate ...

... which can be used for testing purposes or internal usage

Overview

The following is an extremely simplified view of how SSL is implemented and what part the certificate plays in the entire process.

Normal web traffic is sent unencrypted over the Internet. That is, anyone with access to the right tools can snoop all of that traffic. Obviously, this can lead to problems, especially where security and privacy is necessary, such as in credit card data and bank transactions. The Secure Socket Layer is used to encrypt the data stream between the web server and the web client (the browser).

@hirenchauhan2
hirenchauhan2 / QuickSort.js
Created February 19, 2018 05:49
Quicksort algorithm in Javascript
/***
* Quicksort Algorithm
**/
const quickSort = (arr) => {
if (arr.length <= 1)
return arr
else {
const len = arr.length
const pivot = arr[Math.floor(len / 2)];
return [].concat(
@hirenchauhan2
hirenchauhan2 / install_ora_jdbc_driver_maven.bat
Created April 5, 2018 04:50
Install Oracle JDBC Driver in maven repository
mvn install:install-file -Dfile=C:\ojdbc7.jar -DgroupId=com.oracle.jdbc -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar
@hirenchauhan2
hirenchauhan2 / Oracle Query Execution Steps.md
Last active May 2, 2018 17:31
How Oracle Query is executed in steps

How the SQL SELECT Query is exceuted in Oracle

Consider the following SQL Query

SELECT
  deptno,
  sum(sal) total_salary
FROM
 emp
@hirenchauhan2
hirenchauhan2 / findstrings.md
Last active September 24, 2018 10:57
Command to find multiple string in multiple files by using 2 files.

Command to find multiple string in multiple files by using 2 files.

  1. file for string to search -- stringlist
  2. file to list the files from which the string should be searched
  3. Output file where the occurences of strings will be stored with line number of source file and the string containing it.
findstr /g:stringlist.txt /f:filelist.txt > results.out
@hirenchauhan2
hirenchauhan2 / read-excel.ps1
Created October 20, 2020 16:49
Read excel file from Powershell
#Declare the file path and sheet name
$file = "C:\Excelfile.xlsx"
# name of the sheet you want to read
$sheetName = "Sheet1"
#Create an instance of Excel.Application and Open Excel file
$objExcel = New-Object -ComObject Excel.Application
$workbook = $objExcel.Workbooks.Open($file)
$sheet = $workbook.Worksheets.Item($sheetName)
$objExcel.Visible = $false
@hirenchauhan2
hirenchauhan2 / retry-promise.ts
Created September 5, 2023 14:28
Retry a promise
/**
* AbortError is a special error which is used for aborting the retry mechanism of the `retryPromise` function.
*/
export class AbortError extends Error {
constructor(message: string) {
super(message);
}
}
/**