Skip to content

Instantly share code, notes, and snippets.

View bhaireshm's full-sized avatar
🐕

Bhairesh M bhaireshm

🐕
View GitHub Profile
@bhaireshm
bhaireshm / migrate_codecommit_to_github.sh
Created October 28, 2024 18:13
This script facilitates the seamless migration of repositories from AWS CodeCommit to GitHub. It ensures that migrations are not duplicated, verifies the existence of GitHub repositories, and creates new ones if needed. The script logs all activities and maintains a status file to track which migrations have been completed successfully.
#!/bin/bash
# ------------------------------------------------------------------------------------ #
# AWS CodeCommit to GitHub Migration Script
# Author: bhaireshm
# Date: 2024-10-28
# Version: 1.0.0
# Description:
# This script facilitates the seamless migration of repositories from AWS CodeCommit to GitHub.
// app.js
const express = require('express');
const http = require('http');
const socketIO = require('socket.io');
const mongoose = require('mongoose');
const messageSchema = new mongoose.Schema({
user: String,
text: String,
timestamp: { type: Date, default: Date.now },
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Local IP Address</title>
</head>
const { resolve, basename, join } = require("path");
const { rm, existsSync, mkdirSync, writeFileSync, readFileSync } = require("fs");
const prompt = require("prompt").start({ noHandleSIGINT: true });
const helperFolderpath = resolve(__dirname, "helper");
const base_url = "https://api.github.com/users";
const headers = { Authorization: "" };
let showLog = false;
let readJSON = true; // * Note: set this false to get the data latest from github.
var prompt = require("prompt");
var parseString = require("xml2js").parseString;
const path = require("path");
const fs = require("fs");
start();
function start() {
prompt.start();
This file has been truncated, but you can view the full file.
[
{"id":"52180","Regn_no":"11","Acft_Type":"38L","Flight_no":"9W2662","Source":"ATQ","Destination":"DEL","Flight_Date":"2021-05-28 00:00:00","STD":"2021-05-28 10:45:00","STA":"2021-05-28 11:55:00","ETD":"","ETA":"","ATD":"","ABN":"","TDN":"","ATA":"","CargoSpace":"3000"},
{"id":"52181","Regn_no":"11","Acft_Type":"38L","Flight_no":"9W2791","Source":"DEL","Destination":"ATQ","Flight_Date":"2021-05-28 00:00:00","STD":"2021-05-28 12:35:00","STA":"2021-05-28 13:45:00","ETD":"","ETA":"","ATD":"","ABN":"","TDN":"","ATA":"","CargoSpace":"3000"},
{"id":"52182","Regn_no":"11","Acft_Type":"3JU","Flight_no":"9W0431","Source":"BOM","Destination":"IXE","Flight_Date":"2021-05-28 00:00:00","STD":"2021-05-28 13:05:00","STA":"2021-05-28 14:35:00","ETD":"","ETA":"","ATD":"","ABN":"","TDN":"","ATA":"","CargoSpace":"3000"},
{"id":"52183","Regn_no":"11","Acft_Type":"38L","Flight_no":"9W0373","Source":"ATQ","Destination":"DEL","Flight_Date":"2021-05-28 00:00:00","STD":"2021-05-28 14:20:00","STA":"2021-05-28 15:30:00","ETD":"","ETA"
@bhaireshm
bhaireshm / ezjs.md
Last active May 23, 2024 09:06
ez.js helper package

ez.js makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc. The above package has some helper and very useful functions.

Typescript supported

Github Repo

@bhairesh/ez.js

Docs

@bhaireshm
bhaireshm / getDatesInRange.js
Created June 26, 2023 09:30
Returns all the dates between the start date and end date, including both.
function getDatesInRange(startDate, endDate) {
if(!startDate || !endDate) return null;
startDate = new Date(startDate);
endDate = new Date(endDate);
const date = new Date(startDate.getTime());
const dates = [];
while (date <= endDate) {
dates.push(new Date(date));
@bhaireshm
bhaireshm / getNestedValue.js
Last active May 4, 2023 14:22
Get nested value from the given object. It checks for the key first then returns the value.
/**
* Get nested value from the given object. It checks for the key first then returns the value.
*
* @param {object} d
* @param {string} k - key name separated by dot character
* @example
* const data = {
pid: 'some-id',
portions: { name: 'section' }
@bhaireshm
bhaireshm / dataFormatter.js
Created April 19, 2023 17:17
Data formatter - rename/customise keyname and values as you require, even nested keys and nested values can be defined.
/**
* Data formatter - rename/customise keyname and values as you require, even nested keys and nested values can be defined.
*
* @param {object} obj - data to be formateted
* @param {string} formatter - key:valuePath, each key value is separated by comma
* @example "alterName:key" or "alterName:nested.key" or "nested.alterName:key" or "nested.alterName:nested.key"
* @param {object} options
* @param {object} options.error - default true, returns error content if any key or value is not found
* @param {object} options.oldData - default true, returns object
* @returns return modified object along with the provided object