Skip to content

Instantly share code, notes, and snippets.

View AdityaRanjanSingh's full-sized avatar
🎯
Focusing

Aditya Ranjan Singh AdityaRanjanSingh

🎯
Focusing
View GitHub Profile
@AdityaRanjanSingh
AdityaRanjanSingh / README.md
Created February 22, 2021 08:37 — forked from acamino/README.md
Shortcuts to Improve Your Bash & Zsh Productivity

Shortcut — Action

  • CTRL + A — Move to the beginning of the line
  • CTRL + E — Move to the end of the line
  • CTRL + [left arrow] — Move one word backward (on some systems this is ALT + B)
  • CTRL + [right arrow] — Move one word forward (on some systems this is ALT + F)
  • CTRL + U — (bash) Clear the characters on the line before the current cursor position
  • CTRL + U —(zsh) If you're using the zsh, this will clear the entire line
  • CTRL + K — Clear the characters on the line after the current cursor position
  • ESC + [backspace] — Delete the word in front of the cursor
TypeDoc - To generated documentation from typescript code
https://typedoc.org/
@AdityaRanjanSingh
AdityaRanjanSingh / README-Template.md
Created March 25, 2020 10:01 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
@AdityaRanjanSingh
AdityaRanjanSingh / build-bot.sh
Last active March 12, 2020 16:37
Merge separate files for the intent, slot type and bot into one before start import aws lex-model start-import cli
#!/usr/bin/env sh
STATUS_COMPLETED="COMPLETE"
STATUS_IN_PROGRESS="IN_PROGRESS"
IMPORT_STATUS="IN_PROGRESS"
#Clear the distribution directory
rm -rf dis
mkdir dist && mkdir dist/input && mkdir dist/output
#Move to the new lex directory and merge all intents and slot types into single file
gomplate --input-dir=src/lex/slottypes/ --output-dir=dist/input/slottypes --datasource config=iac/resources/env/$ENVIRONMENT/config.json
@AdityaRanjanSingh
AdityaRanjanSingh / loggerService.js
Created March 6, 2020 13:26
A log service for console loggin
export class Logger {
logError(): void {
console.error('Error',...args);
},
logInfo(): void {
console.info('Info',...args);
},
logWarn(): void {
console.info('Warning',...args);
@AdityaRanjanSingh
AdityaRanjanSingh / mock-aws-sdk.test.js
Last active July 21, 2023 08:08
Mocking aws-sdk in jest
const AWS = require('aws-sdk');
//In the test file
const mockDynamodbGetItem = jest.fn();
const mockS3GetObject = jest.fn();
//mock aws sdk
jest.mock('aws-sdk', () => {
return {
@AdityaRanjanSingh
AdityaRanjanSingh / app.js
Created September 30, 2019 22:34
Graphql sample code to query and add items to mongodb
const express = require('express');
const graphqlHTTP = require('express-graphql');
const schema = require('./schema/schema');
const mongoose = require('mongoose');
const app = express();
const MongoClient = require('mongodb').MongoClient;
const uri = "";
mongoose.connection.once('open', () => {
console.log('connected to database')